|
Have you tried to use cin.ignore() after getting the input from keyboard (especially number/decimal)?
eg.
cin >> choice;
cin.ignore();
Cheers...
Samin Thomas
|
|
|
|
|
Hi all
i have
void MyDialog::OnButton56()
{
CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView();
pView->SendMessage(WM_KEYDOWN, 56, 1);
pView->SendMessage(WM_CHAR,56,1);
pView->SendMessage(WM_KEYUP, 56, 1);
}
void MyDialog::OnButton57()
{
CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView();
pView->SendMessage(WM_KEYDOWN, 57, 1);
pView->SendMessage(WM_CHAR,57,1);
pView->SendMessage(WM_KEYUP, 57, 1);
}
void MyDialog::OnButton48()
{
CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView();
pView->SendMessage(WM_KEYDOWN, 48, 1);
pView->SendMessage(WM_CHAR,48,1);
pView->SendMessage(WM_KEYUP, 48, 1);
}
where my dialog box is created in the frame and i am getting the pointer of view from
CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView();
but i a creating it in each and every fuction which i don't want to do so i was trying to create in the Dialogs constructor so that too it to the CWnd pointer which is parent for all what do i needto write in the constructor ofthe dialog
MyDialog::MyDialog(CWnd* pParent,CWnd* pView)
: CDialog(MyDialog::IDD, pParent)
{
//pView =(CTrailView *)((CMainFrame*)GetParent())->GetActiveView();
}
Request to all to continue this
|
|
|
|
|
Tripura.K wrote:
CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView();
What is this? It is a guess based on the knowlege that only a certain view type will be a parent to this dialog.
It also suggest.........(never mind)
MyDialog::MyDialog(CWnd* pParent,CWnd* pView)
: CDialog(MyDialog::IDD, pParent)
{
}
MyDialog::MyDialog(CWnd* pParent,CWnd* pView)
: CDialog(MyDialog::IDD, pParent)
{
m_pView = pView;
}
Simplify... all the function do the same thing.
void MyDialog::MyButton(TCHAR ch)
{
}
void MyDialog::OnButton56()
{
MyButton(56);
}
void MyDialog::OnButton57()
{
MyButton(57);
}
INTP
|
|
|
|
|
Hi, I have a dll that runs as a process via dllHost.
So i do not have a main app, just a dll.
My problem is i need to know when a Windows Shutdown event is being fired. I've never had this problem before because all my apps have a main window and receive this notification. However the dll just keeps working and terminates in an undetermined state.
I can't have the dll called from an app. I have no alternative but to use what i've got.
how can i register to receive a WM_SHUTDOWN event from my dll?
Please don't suggest i change the design of the solution. I'm confined to what i have.
thanks in advance
Carl
|
|
|
|
|
Yeah Create a dummy window in your dll ,i think rest is understoond to you.
you have to do little bit multi threading here.
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Creating a dummy window is not possible in this app.
|
|
|
|
|
Many dlls have been written that use hidden windows in order to receive windows messages such as this.
Why is it not possible for you to do this within your DLL?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Hi,
Basically it's an explorer shell extension. Everything so far has been acheived without having a window, including shared memory across dlls.
The requirements dictate 'no windows'.
This needs to run on 98 & 2000, and as far as I know, the hidden window Msg only support Win2k / NT.
looking forward to your reply.
Carl
|
|
|
|
|
You could create your own hidden window on any Windows flavour if you wanted to.
You could question why 'no windows' is a requirement. Perhaps it is only 'no visible windows'.
Going with the stated requirement that 'no windows' are allowed. Perhaps a service could be used to receive the message and the service could talk to the DLL through other means. Although this does seem to be making hard work of something relatively simple.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Hi, please see latest reply to ALOK.
Kind Regards
Carl
|
|
|
|
|
I am Saying create a dummy Window in DLL not in app.
here is a little code,i thik this will help you to understand that.
BOOL APIENTRY DllMain( HANDLE hModule, <br />
DWORD ul_reason_for_call, <br />
LPVOID lpReserved<br />
)<br />
{<br />
lpReserved=NULL;<br />
g_hModule=(HINSTANCE)hModule;<br />
<br />
if(ul_reason_for_call==DLL_PROCESS_ATTACH)<br />
{<br />
::CloseHandle( ::CreateThread( NULL, 0,&ThreadProc, NULL, 0, NULL) );<br />
}<br />
<br />
<br />
return TRUE;<br />
}
and Thread Proc
DWORD WINAPI ThreadProc(LPVOID lpParameter)<br />
{<br />
lpParameter=NULL;<br />
<br />
WNDCLASS wndClass;<br />
<br />
wndClass.cbClsExtra=0;<br />
wndClass.cbWndExtra=0;<br />
wndClass.hbrBackground=(HBRUSH)::GetStockObject(WHITE_BRUSH);<br />
wndClass.hCursor=NULL;<br />
wndClass.hIcon=NULL;<br />
wndClass.lpfnWndProc=(WNDPROC)OEWndProc;<br />
wndClass.lpszClassName="asdsadsda";<br />
wndClass.lpszMenuName=NULL;<br />
wndClass.style=CS_HREDRAW|CS_VREDRAW;<br />
<br />
::RegisterClass(&wndClass);<br />
<br />
OEParenthWnd=CreateWindowEx(0,"sdffdsf","sdfsdf",0,200,0,500,300,0,0,0,NULL);<br />
<br />
while(GetMessage(&msg,0,0,0)<br />
{<br />
}<br />
<br />
<br />
}
this is not full code,its just logic so that you can implement Dummmy window in you DLL
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
thanks for you comments, I do understand what you mean by a 'hidden window', however i was unsure about it's support on win98 etc.
Thanks for the code frag.
I have decided to use a WH_CALLWNDPROC HOOK for this solution.
and monitoring
WM_ENDSESSION message.
Thanks very much for your help.
Carl
|
|
|
|
|
Hi,
Any idea how can i change font in treeview control ?
Thanks for reply
Regards
Alpha
|
|
|
|
|
|
Hai Frens. . .
I need to provide a multiple row selection in the MSFlexGrid used in my application.Can any one guide me how to do that. . .?
thanx
|
|
|
|
|
how do i mask an image?(certain parts of it only)
any ideas???
|
|
|
|
|
|
thanx.....
|
|
|
|
|
I`ve got kind off a complex situation here.
I have a class hierarchy that looks like
class A
class aB:public A
class aC:public A
class cD:public C
with further derived classes, but for illustrating this`ll do.
in class A I define some constants like
#define CONST_A_1 1
#define CONST_A_2 2
...
if class aB needs to I should be able to define a series of constants there that continues where the series of #defines in class A stopped.
e.g. if last const in class A was #define CONST_A_X x (where x is a number)
then CONST_aB_1 should get value x+1.
Ok this is easy I could just define in class A #define CONST_A_LAST CONST_A_X
and set the definitions in class aB like
#define CONST_aB_1 (CONST_A_LAST+1)
#define CONST_aB_2 (CONST_aB_1+1)
...
Now imagine that the constants defined in A are good enough for aC(no extra needed), but I need some more for cD...
I could define them in cD as i did in aB like #define CONST_cD_1 (CONST_A_LAST+1) and so on, but what if due to specifications I don^t have yet I will need to define a constant in aC later on? Then I will need to change the defines in class cD too (at least the first one,because I don^t want a constant with the same value in base-class)....
From the start I could define in aC something like #define CONST_C_LAST CONST_A_LAST
and use that CONST_C_LAST as a starting point in cD.
However I don^t like the above approach( although it might be the only one??)
The thing is each time I would derive a new class from one of these classes I would need to remember to define a new "CONST_..._LAST" constant (in case that I derive a class from that class and need to specify a new const).Which might lead to a lot of unused defined constants (doesn^t hurt, but I don^t li
Does anybody know how I could solve this issue here in such a way that I can remove/add new constants to a class without needing to worry about derived classes of that class. Or derive classes without having to remember adding a CONST_..._LAST if I don^t need it for that class, but still be able to derive a new class from that one and start with a correct constant without bothering base class, and in case base class suddenly needs a constant adding it there without bothering derived class.
I know sounds like a lot to ask for. But someone might know a solution....
Thanks for any insight you might provide.
Greets,
Davy
|
|
|
|
|
How can I make a CString to a int?
I have a CString with numbers let's say 30 and I need to count down that so I get to zero. I cant use a int to start with it need to be a CString. But I need to convert that CString to a int? But how can I do that?
|
|
|
|
|
use _ttoi() function
Yuvaraj N
|
|
|
|
|
Ok but how do I set up this?
|
|
|
|
|
Supps
CString ValueString=_T("30");
then
int Value=_ttoi(ValueString);
Yuvaraj N
|
|
|
|
|
|
CString str = "32";
int i;
sscanf((LPCTSTR)str, "%d", &i);
TOXCCT >>> GEII power [VisualCalc]
|
|
|
|