|
I got it to work. Thanks.
Heather
|
|
|
|
|
and what was the missing point ??
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20] | soon : [VisualCalc 3.0]
|
|
|
|
|
I had the SetWindowText call in the wrong function. I put it in OnInitDialog and it worked fine.
Heather
|
|
|
|
|
I have a windows message problem that has haunted me for a long time.
Suppose one application has two thread. Thread A "sends" and "posts" message
to a window handle in thread B.
Thread A
{
LOOP{
...
SendMessage(m_hwnd, msg1);
...
PostMessage(m_hwnd, msg2);
...
}
}
in winproc of Thread B:
Winproc
{
case (msg1): do something
...
case (msg2): do something
...
}
my question is: if Thread B is processing msg2, and Thread A are going to
send msg1 , Thread A will wait until Thread B finishes processing msg2??
|
|
|
|
|
The very definition of SendMessage() says that control does not return until the window procedure (the one in thread B) has processed the message. If this is a problem, use SendMessageTimeout() instead.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi David,does that mean: Thread B will always process msg1 then msg2 ,again and again? it could not process two continous msg2?? However, I found in my project,
this situation happens, but not often!
-- modified at 11:54 Wednesday 7th December, 2005
|
|
|
|
|
No.
Thread B will process msg1 and the SendMessage call in Thread A will only return when Thread B has finished processing.
Then Thread A will Post msg2 but the PostMessage call will return immediately without waiting for Thread B to process it.
Then it may be possible for Thread A to return to the top of the loop and send another msg1 while Thread B is still processing msg2.
That is precisely the way SendMessage and PostMessage are designed: SendMessage waits for processing, PostMessage doesn't wait.
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
jinzhecheng wrote: my question is: if Thread B is processing msg2, and Thread A are going to
send msg1 , Thread A will wait until Thread B finishes processing msg2??
Offcourse... Thread B should finish previous Message Processing before taking new task...
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Sir
Can any help me in knowing which message is fired
when Windows is
1)about to Shutdown?
2)when we press F1;
3)when we click on Shutdown among 3 options
ie; restart,shutdown,standby.
i am waiting 4 u reply , i have this doubt form many days thank u for helping me in order to understand vc++ msgs.
bye
Satishvarma.E
|
|
|
|
|
Intercepting the Ctrl+Alt+Del sequence is not a trivial task. To do it effectively requires a good knowledge of GINA.
When Windows is being shut down or restarted, it will send a WM_QUERYENDSESSION to each top-level window. Handle that message accordingly.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: When Windows is being shut down or restarted, it will send a WM_QUERYENDSESSION to each top-level window.
I see this answer quite often when it comes to questions about system shutdown/logoff so I want to clarify something. I have always been under the impression that the message to handle for system shutdown is WM_ENDSESSION not WM_QUERYENDSESSION . Query just asks the running apps if it is ok to shut down the system at this time, it makes no guarantees that the system is actually shutting down. If you close your app when it recieves the query it may end up being closed when the system is not shut down, leaving the user confused as to why the app closes on it's own for some unknown reason. Or am I misreading what it says in MSDN?
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote: Or am I misreading what it says in MSDN?
Your comprehension is fine. Most folks ask the question in a general sense. In this case, I usually direct them to WM_QUERYENDSESSION where they can then (hopefully) find WM_ENDSESSION , too.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I am trying to specify the paper tray / bin from which to print a document. I am using the DEVMODE structure and a call to CreateDC(). My other DEVMODE attributes work perfect, but no matter what I do, I cannot get the document to print from a different tray.
Code snippet here:
...
devMode.dmDefaultSource = this->tray; /* number between 1 and 15 */
devMode.dmFields = devMode.dmFields | DM_DEFAULTSOURCE;
return CreateDC(NULL, inPrinter, NULL, &devMode);
}
This has been driving me crazy for too long.
Any help is appreciated.
Craig
|
|
|
|
|
rcraigadams wrote:
devMode.dmDefaultSource = this->tray; /* number between 1 and 15 */
From where you getting this->tray... have you make a call to DeviceCapabilities ( which reterive capabilities of printer device)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi All,
I'm really baffled and having struggled for several days, I need to bare my soul and ask for help
With C++ VS 6, I have created a COM component, added an ATL (Full Control), added methods and events to the appropriate interfaces and then created a modeless dialog (CDialog) in the component. The control has no CWnd so when I create the modeless dialog, I use Create (IDD,NULL) where the NULL indicates, I think, that the parent is the main app window, of which there is none, at least not in the COM component itself.
Things all work well so far and I have added a bunch of standard dialog controls, buttons, statics, edit controls, etc all working fine EXCEPT I am unable to use the TAB key to move between edit controls. In general, it seems that mouse messages are sent to the dialog where I can handle them but most keyboard messages (WM_CHAR, WM_KEYDOWN, WM_KEYUP, etc. are not. In fact, I even added a PreTranslateMessage handler to the dialog, but it never even gets called?
In desperation, I added a PreTranslateMessage handler to the "MFC host app" that instantiates and uses the COM component and indeed I can capture the messages of interest from the CDialog in the COM component, WM_CHAR, WM_KEYDOWN, WM_KEYUP, etc but of course it doesn't do me much good to have the messages at this high level. My guess is that the messages get to the MFC host app because, to a COM component, the host app "is" the main application window??
Either way, I really need to have the dialog in the COM component allow the user to tab between edit controls. Any help would be greatly appreciated.
Thanks,
Doug
Doug Knudson
|
|
|
|
|
Sir i want to insert more than one checkbox for
mutiple selection in menu.I have tried ON_UPDATE_COMMAND_UI,we could perform only one selection
form many menu item, Sir could u please help
me to how to insert any controls(CheckBox,radio,spin)as
menu items.
Satish varma.E
|
|
|
|
|
I don't think I have seen such stuff before.
You could create a modeless child dialog with custom controls and so on, and show it when the menu header is clicked, and at the right place, and handle the problem of the whole dialog losing focus, and hiding it yourself. It would look cool with all the controls, but it is a difficult lengthy task.
this is this.
|
|
|
|
|
Hi all:
I tried to sort out creating a bmp file and save an image in C++. It really annoyed me. Following is my test code, but it doesn't work. Could somebody give me an idea how to create a bmp file and store an image please????
Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
void draw(){
int x[100];
int n = 0;
for(int i = 0; i < 10; i ++){
for (int j = 0; j < 10; j ++){
x[i*10+j] = n++;
if (n >= 255) n = 0;
}
}
HBITMAP map = CreateBitmap(10, 10, 1, 8, x);
if (map == NULL) cout << "cao ni ma\n";
HANDLE hf; // file handle
BITMAPFILEHEADER hdr; // bitmap file-header
BITMAPINFOHEADER bih; // bitmap info-header
LPCTSTR filename = "output.bmp";
DWORD dwTmp;
hdr.bfSize = sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+sizeof(x);
hdr.bfReserved1 = 0;
hdr.bfReserved2 = 0;
hdr.bfType = 0x4d42;
hdr.bfOffBits = sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER);
bih.biSize = sizeof(BITMAPINFOHEADER);
bih.biWidth = 100;
bih.biHeight = 100;
bih.biPlanes = 1;
bih.biBitCount = 8;
bih.biCompression = BI_RGB;
bih.biSizeImage = 0;
bih.biXPelsPerMeter = 0;
bih.biYPelsPerMeter = 0;
bih.biClrUsed = 0;
bih.biClrImportant = 0;
hf = CreateFile(filename,
GENERIC_READ | GENERIC_WRITE,
(DWORD) 0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
(HANDLE) NULL);
WriteFile(hf, &hdr, sizeof(BITMAPFILEHEADER),(LPDWORD) &dwTmp, NULL);
WriteFile(hf, &bih, sizeof(BITMAPINFOHEADER), (LPDWORD) &dwTmp, NULL);
WriteFile(hf, (LPSTR) x, 100, (LPDWORD) &dwTmp, NULL);
}
Asura
|
|
|
|
|
Hello Luo ming,
Take a look at "programing windows", there is intensive discussion about bitmap
stuff.
Good luck!
|
|
|
|
|
Ming Luo wrote: WriteFile(hf, (LPSTR) x, 100, (LPDWORD) &dwTmp, NULL);
for starters, for a 100x100 RGB image, you need to write 300 bytes worth of pixel data per each pixel row. looks like you're only writing 100 bytes total.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
hi , plz help me to read seralnumber harddisk or read sazi darddisk
or read serialnumber mainbord
tnx for help me
nader
|
|
|
|
|
|
kakan wrote: Use GetVolumeInformation(). See here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/getvolumeinformation.asp[^]
Hai Kakan,
Sorry for trouble, little correction buddy.. that api return the Volume Serial Number not the Hardisk or Motherboard..
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hello Alok. You are right (of course).
|
|
|
|
|
yasa294 wrote: hi , plz help me to read seralnumber harddisk or read sazi darddisk
or read serialnumber mainbord
tnx for help me
look at this :-
Computer System Hardware Classes [WMI][^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|