|
In fact, if you look at the TIMERPROC definition in winuser.h it is as follows:
typedef VOID (CALLBACK* TIMERPROC)(HWND, UINT, UINT_PTR, DWORD);
|
|
|
|
|
|
CALLBACK should be present either in declaration (.h file) and definition (.cpp file).
Otherwise they are two different functions.
In your case the compiler knows about a CALLBACK prototype, by supply a __cdecl function to the linker (it wold have been __stdcall instead).
casting a __cdecl into a __stdcall is dangerous, since the stack is managed differently (you can overwrite some caller / callee local variables ... that could lead to very nasty bugs!
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
try giving 4th param as 0
|
|
|
|
|
Hello everyone, I wanted to know if the OnSelChange event of the combo box can be accessed outside of the dialog file, as i need to access and change the code in a different file within the same project.
|
|
|
|
|
You may 'forward' the notification: inside the OnSelChange method, nothing prevents you to call any (public) method of any object you may reference.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi
I am using a tree view control . there are three columns in my tree view control . is there any way to re arrange the coloumns of tree view control.like if i click on first coloumn and drag to second coloumn second coloumn should be at first coloumns position and first coloumn should be at second coloumns position
|
|
|
|
|
(Wow !) Could you post a screenshot please ?
virtual void BeHappy() = 0;
|
|
|
|
|
Good to see u again Eugen
I changed my mind I m using a List view control now
will be great if i get the same functionally of coloumn swaping.......
how do i post an image..?
|
|
|
|
|
No screenshot needed, thank you !
Try something like it:
.. CYourView::OnInitialUpdate(..)
{
CBaseOfYourView::OnInitialUpdate(..);
CListCtrl* pcList = GetListCtrl();
if (pcList) {
pcList->ModifyStyleEx(0, LVS_EX_HEADERDRAGDROP);
}
...
}
..or, when your usage of CListCtrl is in a dialog:
BOOL CYourDialog::OnInitDialog()
{
CYourDialogBase::OnInitDialog();
CListCtrl* pcList = (CListCtrl*) GetDlgItem(IDC_LIST1);
if (pcList) {
pcList->ModifyStyleEx(0, LVS_EX_HEADERDRAGDROP);
}
...
}
virtual void BeHappy() = 0;
|
|
|
|
|
Eugen my aplication is win32
so how can i achieve ModifyStyleEx
|
|
|
|
|
Try it, after the list has been created :
SendMessage(hWndList,
LVM_SETEXTENDEDLISTVIEWSTYLE,
LVS_EX_HEADERDRAGDROP,
LVS_EX_HEADERDRAGDROP);
virtual void BeHappy() = 0;
|
|
|
|
|
Thanks a loooot Eugen
again you helped me ...
its working great....
thanks a lot
|
|
|
|
|
I built an system using MFC dialuge and you can considre it like question answering system take its knowledge from Access DB and the system is just one interface like any chatting interface(msn,yahoo,...) one box for entering text and a nother box for displaying the system answer or text and one send button.
My problem is I need to put my system online So I need your suggestions in this issue?
What are the techniques should I use to make this happen?
I searched about CGI with VC++ and its looks useful and some links told me to convert my system to dll files after that link it to HTML page but I have no experince in both of them so please any one have an ideas thats will be so appreciated because I don't want to read and waste my time in the wrong direction?
Please note: What about the DB because many users should use the system at the same time.
Thanks alot
|
|
|
|
|
Write an ASP.NET or Java front end. A CGI implementation would be ugly in the extreme by comparison.
IMHO, of course.
L u n a t i c F r i n g e
|
|
|
|
|
thanks for your reply but VC++ doesn't support ASP.net and I have no idea about how i can connect the java with MFC.
|
|
|
|
|
Dude... use your head. The suggestion was to create an ASP.NET or Java front end to your database. Java or ASP.Net can be used to develop a web-based front end. It doesn't have anything to do with MFC - it's an alternative approach, and one much better suited to your design goal. MFC was not intended to be used as a web UI framework. Yes, you can probably port your logic to a CGI app, but it's an ugly, error-prone and time-consuming approach, compared to using a framework that is INTENDED to be used to develop web-based UIs.
L u n a t i c F r i n g e
|
|
|
|
|
You need to redo your UI (front-end) to be web oriented ( asp, flash, silverlight, ... ) that calls something server-side.
unfortunatly, I don't think you can do the front-end with MFC.
good luck.
Watched code never compiles.
|
|
|
|
|
Thanks for all
I'll try each suggestion and all replys appreciated.
|
|
|
|
|
What i try to acomplish: when the user presses VKMENU a textbox is shown. This works fine with one problem. When the editbox is shown it immidiatly also shows a contextmenu containing options for cut, paste, copy and so on.
This contextmenu is also shown when you rightclick in the editbox or press vkmenu while you are in the editbox. This is standard windows behaviour.
It seems that the key that triggers the code to show the editbox (vkmenu) is somehow routed to the editbox. My question: how to prevend this?
Note: When the user presses vkmenu while IN the editbox the contextmenu must still be presented.
Note2: When i change the code so that for example Alt-space will show the editbox the problem disappears, but that is not a solution in my case.
Note3: I've been experimenting with the returnvalue of the dispatcher, without any succes so far.
Any suggestions?
|
|
|
|
|
Show some code, how and where did you "catch" VKMENU and how did you handle it? Try adding a message handler for WM_KEYDOWN to your edit box and see if the VKMENU goes thorough there. If yes, you could either set some flag, if the flag is on, VKMENU is swalowed by your handler (does not pass it on to the __super version) and the flag is set off again, if it is off then it is passed along to the __super method. Then, when you "bring up" the edit, set the flag to on. Another aproach would be to clear the messsage queue of any incoming WM_KEYDOWN and/or WM_KEYUP messages targeted to your edit box after it has been created (you could do this using PeekMessage with PM_REMOVE specified). Don't know if any of these are doable or reliable though so if you choose to try them, be carefull...
[edit] I did some experimenting, it seems that the local menu is displayed when you release the "VKMENU key" so my guess is that you catch the keydown event, bring up the edit field, set the focus to it, and then when the key is released then the keyup events goes to your edit box and tadaa, it displays the menu. Maybe try displaying your box on keyup instead of keydown if that workds for you.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Code-o-mat wrote: [edit] I did some experimenting, it seems that the local menu is displayed when you release the "VKMENU key" so my guess is that you catch the keydown event, bring up the edit field, set the focus to it, and then when the key is released then the keyup events goes to your edit box and tadaa, it displays the menu. Maybe try displaying your box on keyup instead of keydown if that workds for you.
That is exactly what happens! Good answer. So either i swalow the VKMENU in the keyup-handler, or i set up the editbox at Keyup. Sounds simple. I'll be back is that's not the solution.
Thanks
|
|
|
|
|
|
Vaclav_Sal wrote: Could someone kindly explain this MS language to me in plain English?
“Return Value
The result of the message processing; its value depends on the message sent.”
What part do you not understand? If you sent WM_GETTEXT to a window, you will get the text that corresponds to that window returned to you. If you sent LB_GETCOUNT to a listbox control, you will get the number of items in the listbox control returned to you. If you sent WM_SETFONT to an edit control, you will get nothing back as that message does not return anything.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Vaclav_Sal wrote: Could someone kindly explain this MS language to me in plain English?
“Return Value
The result of the message processing; its value depends on the message sent.”
Hi Vaclav,
The SendMessage Function[^] can be used for inter-process/thread communication. What the MSDN article is saying is that the LRESULT value returned from each window message is interpreted differently. For example:
WM_SETCURSOR Message[^] will return TRUE or FALSE.
WM_GETFONT Message[^] will return HANDLE or NULL.
And it is the same for all other messages... You cannot understand what the the LRESULT value means unless you also know what message was sent. (This is essentially what the sentence means)
Best Wishes,
-David Delaune
|
|
|
|