|
The UI thread of course has a window procedure which the worker thread can post or send message to.
|
|
|
|
|
Of course. But it is not possible the other way around.
|
|
|
|
|
You can use events for symchronization you can also use Other synchronization objects like Critcal section.
You cant pass messages to worker thread.
If you wanna communicate from worker thread ->UI thread you can pass messages.
i Hope it is useful.
Thanks,
SandipG.
|
|
|
|
|
Also, check out PostThreadMessage()
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the number 3
|
|
|
|
|
Hi,
what can be the possible solution if i want to run video on web page.
Regards
|
|
|
|
|
Using ActiveX control
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
use ActiveX control or DirectShow development on web.
|
|
|
|
|
I am getting the expected MIDI acknowledgement messages in release mode from the H/W but some MIDI messages are missing in debug mode( not coming to WindowProc() ). Is there any difference in behaviour of WindowProc() between debug and release mode?
Best Regards,
Suman
|
|
|
|
|
I don't think there's a difference between Debug and Release mode for WinProc(),please check your code and make sure.
|
|
|
|
|
I can't seem to do this, I've found some things here and there explaining how to do it, but all I end up doing is rendering my program unable to start up. I could go into the linker turn on ignore default libraries and and I get a 2kb program that pops a messagebox. When I try to bring up my actual interface though...
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
MessageBox(NULL, "Messagebox.", "Hi.", MB_OK);
return 0;
}
but replace messagebox with DialogBox(hInstance, MAKEINTRESOURCE(IDD_DLG1), NULL, DialogProc); and I get an unusable program.
I'm still new to this C thing, but so far the program is entirely win32 api, and single digit kb files are more appealing than 40kb ones. I've seen a bunch of programs that show off stupidly low files sizes, one even being 1kb, but I can't seem to achieve this effect. I can guess what I'm doing wrong but I don't know how to correct it. The 1kb one comes with a readme explaining how it was done, last step which I don't get is...(which is where you actually drop the CRT)
- skip a standard WinMain-EntryPoint by defining a new EntryPoint
via the "ENTRY" linker command
Could somebody please explain how I can accomplish it? I don't really get how to create a new WinMain function.
|
|
|
|
|
choadvach wrote: int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
To the entry point of an application, i dont think any parameters are passed in to it. That means the HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow are all junk values.
May you can try like this
int WINAPI WinMain()
{
HINSTANCE hInstance = GetModuleHandle(NULL);
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DLG1), NULL, DialogProc);
return 0;
}
And let me know the result.
|
|
|
|
|
Thanks a ton, this worked perfectly! All this time it was so simple and I was just blowing my mind over nothing.
|
|
|
|
|
Naveen.R wrote: That means the HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow are all junk values
What do you mean by this, these are junk values?
|
|
|
|
|
I mean kernel32.dll will not pass those parameters to the application entry point. Have you checked how an application entry point is? check the WinMainCRTStartup function. You can find how that function calls the winmain of an application.
|
|
|
|
|
Hi all,
How to use edit box.I want to enter some string in the edit box and pass it as an argument to some function.
|
|
|
|
|
You can use of SetWindowText for set text and for retrieve text use of GetWindowText .
|
|
|
|
|
Hi, I have a windows service program where I use it to run another program using the ShellExecute command. However, I dont know how to terminate the spawned program as I am new to VC++ programming.
Anyone has any idea?
Moonis
|
|
|
|
|
|
My application takes longer and longer to compile and run. I program in C++ Builder 2006. Each time I change something in my apps' Core bpl, it takes about 5 minuets to compile and up to 2 minuets to link. I waste about 1 hour a day waiting for my code to compile!
Anybody have some pointers on how to optimize this kak process? Is it my header hierarchy or what influences the compiling and linking? -besides the lines of code.
Thanks
|
|
|
|
|
The only thing I can think of is that it's your header file inclusion, each time you change the definition in a header file all the source files that include it will get reprocessed, and depending on your compiler multiple inclusion of header files from different sources indirectly will only increase the preprocessing time. Only include the header files in the source that actually need them! Also do NOT have your header file include other header files, sometime you can't get away from this but most of the time developer are plain freaking lazy and will shover all kind of crap they don't need, or they have a global header file that includes other header, etc.
The other thing you could do is separate your code and make it more modular and isolate functions, API, etc. Then you only have to rebuild (hopefully) that one module and link with it everywhere else saving time?
Last solution, and the best!!!! Don't make changes to the code and then you don't need to worry about them pesky compiler problem!!!
5 min + 2 min is nothing to complain about man!!! Some projects I know have taken much much longer to build
|
|
|
|
|
It could be something in your header file hierarchy. Is a pre-compiled header option available with Builder ?
One thing I am now in the habit of doing (and I get some flak for) is a more proactive form of header inclusion guards. I use an included definition of the form :
#ifndef _INCLUDEFILE_H
#define _INCLUDEFILE_H
...
then I also put this in comments for easy cutting and pasting :
and I use this form whenever I place an include statement in a header whether I am including one of mine or one from the compiler. Always !
Also - I usually take this even a bit farther. I make it a fatal error if a file is repeatedly included and this helps track them down quicker. This is done as follows :
#ifndef _INCLUDEFILE_H
#define _INCLUDEFILE_H
#else
#error repeated include of this file
#endif
You can comment off the #else and the #error if you don't want that to be a fatal error.
In the past I have made the conversion to this style very quickly because it's easy to do and it has always resulted in significant improvements in compile time for me. In fact, generally speaking, the larger the project the larger the speed-up that I have seen.
Now, this is only a compile time improvement so it does not address your link time issue. There are lots of variables involved in link time. Efficiency of the linker, amount of available memory, and hard drive speed are three biggies. Unfortunately I don't have any easy answers for this.
|
|
|
|
|
Cool maneuver. Here I always thought that it's less efficient if you have one Include header.
Thanks!
|
|
|
|
|
Also...
You aren't doing full builds every time, are you?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the number 3
|
|
|
|
|
Yeah, I'm working in my Core at this time. It has alot of different helper forms, -casses and automation functions. I have to recompile the whole shabang, even if I only added a ShowMessage for debugging - The Builder Debugger crashes alot during step-trough variable inspection and i've lost tooo many code. (thanks to Builders bugs. )
|
|
|
|
|
Things to look into:
1. Precompiled headers.
2. Unneeded include files.
3. Using abstract base classes as interfaces to avoid having to include class definitions.
Steve
|
|
|
|