|
Nope, not using MFC, using the resource editor and the winapi.
The wisest of the wise may err. - Aeschylus
|
|
|
|
|
Oh... than take a look on what Rage wrote ...
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
You get the HWND of the dialog (not "CWND") as the first parameter to the dialog box function. Also, if the dialog is modeless, its HWND is the return value from CreateDialog() .
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
If you're running under WIn API, you'll have somewhere in your code a place where you create your main window. This is your CWnd. To add controls in your CDialog, just pass a *CDialog instead of a *CWnd, since CDialog is derived from CWnd (and this, not only in MFC).
Finally, if your main win is your dialog, you may pass NULL pointers to create the controls (see MSDN)
Hope this helps-
~RaGE();
|
|
|
|
|
Hi :
This must be easy for some ... but I am having trouble getting it to work.
My project is a dialog form, and it has only 1 button - IDC_BUTTON1.
The following are codes associated :
void CYDlg::OnButton1()
{
// TODO: Add your control notification handler code here
AfxMessageBox("Single Click") ;
}
void CYDlg::OnDoubleclickedButton1()
{
// TODO: Add your control notification handler code here
AfxMessageBox("DoubleClicked") ;
}
Clearly, if I click on the button or twice, it should show the appropriate messag. However, I am always only getting "Single Click" no matter how many clicks I try.
Am I missing something ?
TIA.
|
|
|
|
|
When you double-click something, it first receives a clicked message (for the first click) and then a double-clicked message (for the second). Since you show a message box on the first click, that disables the dialog (since the msg box is modal) making the button unable to receive the second click. Remove the message box from your OnButton1() handler and you'll see.
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
You are right ! Thanks for the explanation.
|
|
|
|
|
Why would you want to double click on a button
Never seen that, done that or will do that.
regards,
Michel Wassink
We must make user friendly software. Where are friendly users?
|
|
|
|
|
Hi :
One never knows .... I am just exploring VC++.. and since the wizards show that it is doable .....
Here's a dumb question then. Follow up from previous mail ... what if I want to open dialog1 if user single click, and open dialog2 if user double click.
Does this mean this is not possible, or have to done in different way ?
Cheers.
|
|
|
|
|
Quek Khoo Boon wrote:
Does this mean this is not possible, or have to done in different way ?
Maybe it's possible, maybe not. I don't want to know.
Go to the next page of your book and start with more interesting things;P
Michel Wassink
We must make user friendly software. Where are friendly users?
|
|
|
|
|
hi,
can anyone help..I want to load bitmaps from hard drive into my application..any suggestions are welcome..
thanks in advance..
cheers
Himanshu
|
|
|
|
|
Call LoadImage() and use the LR_LOADFROMFILE flag. This will get you an HBITMAP which you can use with GDI functions.
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi,
I am developing a TAPI application to send and recv data. I was able established the connection between the application. Now I want to send and recv data between them. I'm using ReadFile() and WriteFile(). But when I try to set the comm state, it gives me an error. Some times it gives an error INVALID_HANDLE in Write file(). How to get the comm handle ? I have used the LPVARSTRING to get the handle. Is it correct? How to use the WriteFile() and ReadFile() function.
Pls help...
Vini
|
|
|
|
|
Hi,
I've been working on some ATL components, and I use VB as the testbed for them.
Normally I compile the DLL and register it, set a breakpoint in the code, and point to my VB application as the debug executable, and when my function get's called my breakpoint is hit, and I'm into debug mode.
BUT all of a sudden, the breakpoints are just being skipped.
Is there something obvious I've missed?
|
|
|
|
|
Hi all,
What is the win32 API equivalent of 'malloc' and 'free' ?
Which of these is better ?
thanks in advance
Hari Krishnan
|
|
|
|
|
The C++ language exists outside the Windows world, in fact it was even concieved there. So win32 has nothing to do with it. The C++ equivelent to the C functions 'malloc' and 'free' is 'new' and 'delete'. You should always use the C++ versions.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Christian Graus wrote:
You should always use the C++ versions.
???? why ????
Thin Lizard
|
|
|
|
|
Because you can't malloc and delete, new and free, so it's easier not to mix them up. Because you get constructors and destructors out of it ( man, do I miss destructors in my .NET world ).
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Christian Graus wrote:
Because you get constructors and destructors out of it
yeah, i guess that applies to C++. but the original poster didn't mention C++, only Win32.
-c
Thin Lizard
|
|
|
|
|
Well, the fact that he said Win32 makes me think he's probably a newbie, almost certainly using C++. If he's not, then my answer will make clear that the stuff I've said does not apply. I presume I'm right in thinking that the Win32 API does not provide an alternative malloc ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
there's a whole host of allocation functions in Win32: Global/Heap/Local/VirtualAlloc and so on.
-c
Thin Lizard
|
|
|
|
|
Thanks a lot for help guys .
I dont think i can use new and delete because i want to use realloc.
I really dont know anything about heap/global/local allocs.
since mike said its better to use CRT, i will stick to malloc.
Hari Krishnan
|
|
|
|
|
pranavamhari wrote:
I dont think i can use new and delete because i want to use realloc.
I believe that is so. Why do you want to use realloc ?
pranavamhari wrote:
since mike said its better to use CRT, i will stick to malloc.
I am going to ask him, because AFAIK, new and delete also give you everything he mentioned. I strongly dispute the wisdom of using C memory allocation in C++, but Mike is a hell of a smart guy, so I'm keen to hear what he says.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
The I guess you don't like STL. STL uses malloc and free all over the place due to the limitations of new and delete.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Man, you don't miss a trick, do you ? :P
My point remains, that as an end user, I do not call the C library because it confuses things and because I like constructors and destructors. The fact that it's used in a library for specific reasons does not affect my decision.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|