|
I assume you're using CComboBoxEx because CComboBox does not have a SetImageList() function.
Have you associated an image with each item?
COMBOBOXEXITEM cbItem;
cbItem.mask = CBIF_IMAGE;
cbItem.iItem = nItem;
cbItem.iImage = nImageIndex;
m_Lang.SetItem(&cbItem);
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
A sentence is like below:
lpwndpos->flags &= ~SWP_SHOWWINDOW;
What is the meaning of "&"?
Thanks
|
|
|
|
|
Is it has the same meaning as below?
lpwndpos->flags = &(~SWP_SHOWWINDOW);
|
|
|
|
|
Aleon666 wrote:
Is it has the same meaning as below?
lpwndpos->flags = &(~SWP_SHOWWINDOW);
No. In the first question that you posted '&' is the binary operation AND.
lpwndpos->flags &= ~SWP_SHOWWINDOW is the same as
// pseudo code
lpwndpos->flags = lpwndpos->flags AND (NOT SWP_SHOWWINDOW)
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
The "&=" is an abbreviation of: lpwndpos->flags = (lpwndpos->flags & (~SWP_SHOWWINDOW)). So this is a bit AND operator.
The "~" means you invert all the bits that are in SWP_SHOWWINDOW (all 0 becomes 1 and all 0 becomes 1).
So this sentence just means you will put the bits specified by SWP_SHOWWINDOW (all the bits that are 1 in this constant) at 0 in lpwndpos->flags.
Hope this is clear enough !
|
|
|
|
|
I see.
Thank you very much!
|
|
|
|
|
|
|
Hi Guys,
I am writing a windows service to start / stop certain utility applications. The utilities are in Vb (Please don't ask me why a background process was programmed in vb, I don't know that myself). I used CreateProcess to start them, that was fine.
Now the problem arises when I want to stop them. I can't use TerminateProcess because the applications may be in the middle of something and I want to wait till they finish the job at hand. So I decided to use messages.
I tried PostThreadMessage. The problem I have was that on the utilities' side, if I used GetMessage then it waits for the message which makes the application hang and if I used PeekMessage then in some cases it was missing the Message altogether.
Finally I thought of using a dummy subclassed form and sending the message to to form. It's working now, but it seems like a mess to me. I'm pretty sure there's a better way. Any suggestions?
thanks.
P
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
|
|
|
|
|
Take a look two or three messages down "how do i Detect if an external program has finished excuting(shellexec)?" and read Rage's and cmk's messages. I think, they apply to you as well.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
I am waiting for them to finish.
Actually, I don't just want to wait for the programs to finish. I actually want to tell them to wrap up whatever they are doing and end.
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
|
|
|
|
|
PostThreadMessage() /PeekMessage() should work. Messages can not get lost if they're being sent to the correct thread, as long as you specify NULL (or 0 in VB) for the HWND parameter, and PM_REMOVE as the flags parameter. My VB is a bit rusty, but:
If PeekMessage(msg, 0, 0, 0, PM_REMOVE) = True Then
If msg.message = MY_MESSAGE Then
ExitProcess 0 ' Exit the process
End If
End If Where msg is the MSG structure variable and MY_MESSAGE is the value of the message that you are sending. I can't remember if the PM_REMOVE constant is declared like that, or whether it has a different name. Of course, if a different message is received, then it will need to be processed as well. If PeekMessage() returns False, then a message did not exist.
Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Thanks a lot. That's exactly what I had done.
But PeekMessage doesn't wait for the next message to arrive.
As a result, if the message arrives when the program might be in the middle of a transaction.
Could it be that by the time I call PeekMessage again the Message get processed (maybe by some default message handler which cannot comprehend the meaning of my user defined message?)
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
|
|
|
|
|
parths wrote:
But PeekMessage doesn't wait for the next message to arrive.
That's correct. If you need this, then you need to use GetMessage().
parths wrote:
Could it be that by the time I call PeekMessage again the Message get processed (maybe by some default message handler which cannot comprehend the meaning of my user defined message?)
Absolutely. If you're using more than one message loop, then you have to make sure all the message loops know about the message. It will probably be easier to code your main message loop similar to this:
Do While GetMessage(msg, 0, 0, 0) = True
If msg.message = MY_MESSAGE Then
ExitProcess 0
Else
TranslateMessage msg
DispatchMessage msg
End If
Loop This should work (I think )
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Thanks,
I had tried GetMessage, but then it doesn't return till it gets a message (any message) (right?), and that's a problem too because then I can't continue processing until I get a message. So I'll have to keep sending dummy messages to the app.
I'll look for possible 'hidden' Message handlers, but is it possible that VB has it's own message handler which sort of peeks at all the messages coming into the app before forwarding them to the program message handlers or individual message handlers? I'm guessing that is what calls the VB event handler functions
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
|
|
|
|
|
parths wrote:
I had tried GetMessage, but then it doesn't return till it gets a message (any message) (right?), and that's a problem too because then I can't continue processing until I get a message. So I'll have to keep sending dummy messages to the app.
Not necessarily. Modify the message loop so it uses PeekMessage() instead of GetMessage() and do the processing after the PeekMessage() handling:
Do While True
If PeekMessage(msg, 0, 0, 0, PM_REMOVE) = True Then
If msg.message = MY_MESSAGE Then
ExitProcess 0
Else
TranslateMessage msg
DispatchMessage msg
End If
End If
' Do your processing here
Loop
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
In a controller I made I want to catch if user presses alt+return.
and I do it in OnSysKeyDown and everything works. BUT somehow a ‘boing’ sound is getting played.
Like if I pressed some illegal key combo.
How can I Stop it. It gets on my nerves.
(You get the same sound if you stand in IE and press alt+return )
|
|
|
|
|
Hello,
i must read values from an Excel sheet, which becomes updated by another program. So i tried to open the Excel-File with CDaoDatabase and open a CDaoRecordset with the OpenType "dbOpenDynaset".
I can reed the values from the sheet, but the recordset wasn´t updated, if the values from the sheet have changed. I must open and close the recordset again.
Another thing is, that i get the message, that the Excel-File is blocked by another user", when i try to open the Excel-File.
But the attribut bExclusive from the CDaoDatabase::Open is set to FALSE.
Thanks
Andy
|
|
|
|
|
Hi Andy!
Thought I should take a short look for the news...
Andy@ wrote:
Another thing is, that i get the message, that the Excel-File is blocked by another user", when i try to open the Excel-File.
I think you should open it as a snapshot, but then you don't have an actual update...
Did you check that xt54 stuff??
There was a good class for that...
Hope it helps a little...
Greetings from a strange world!
Olli!
Olli
"Ooooooh, they have the internet on computers now!" Homer Simpson
+ = NULL :=>
|
|
|
|
|
Hi Olli!
Nice to hear about you.
I use the xt54 stuff, it´s good to create a snapshot.
So i can get a actual update when i open and close the recordset cyclically. But this only works when i first open the file with excel and then change the values.
But when i create a test app which use a dynaset recordset for writing data and another dynaset recordset for reading data, i get the actual update.
So i must find out, how exactly the datas become changed in the excel sheet.
Greetings
Andy
|
|
|
|
|
I want to execute several external programs in a que. I have to execute one program and wait for it to finish and excute another. Is there a way to detect if a external running program has finished?
Thanks
|
|
|
|
|
Now this might sound way off because I don't know what you're trying to do, but you could write a batch file "somefile.bat" and there you can put the names of your programs. I don't know if you're familiar with batch files so for example to execute notepad, paint, and minesweeper one after the other you could just write
c:\windows\notepad
c:\windows\paint
c:\windows\winmine
paint won't start until notepad closes and so on. So you can just try to execute this batch file from your program and you won't have to worry about the checking them (unless you want the opposite).
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Use CreateProcess instead of ShellExecute , and use WaitForSingleObject like this :
STARTUPINFO lpsi;
lpsi.cb=sizeof(STARTUPINFO);
lpsi.cbReserved2=0;
lpsi.lpReserved2=0;
lpsi.lpReserved=0;
lpsi.lpDesktop=NULL;
lpsi.lpTitle="Doing something ...";
lpsi.dwFlags=STARTF_USESHOWWINDOW;
lpsi.wShowWindow=SW_SHOWMAXIMIZED;
PROCESS_INFORMATION lppi;
if (CreateProcess(NULL,(LPTSTR)path.operator LPCTSTR), NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, m_TotalCompPath.operator LPCTSTR(),&lpsi,&lppi)==0)
else
{
WaitForSingleObject(lppi.hProcess,INFINITE);
}
~RaGE();
|
|
|
|
|
WaitForSingleObject() will allow you to wait on a process handle.
It uses the handle from CreateProcess() or OpenProcess().
The handle is signaled when the process terminates and is non-signaled while running.
...cmk
|
|
|
|
|
I know how to make a checksum and the other day I was wondering if it is possible to have an exe perform a checksum on itself. I know that it is possible but, there is a catch to it. I realize that you could use a dll function to find the checksum of the exe, or you can put it in the registry, or who knows what other methods you could use. My question is the following:
Let's say that you have a single executable file. Is it possible to have this file perform a checksum on itself but without geting the checksum number from external sources (i.e. files, registry, dlls, etc.)? I was thinking that you cannot hardcode it in the source code because you don't know what the checksum would be until you compile the code, but then again, after you compile it, you can't change the exe because the checksum would change as well. It seems impossible to me to perform a checksum check without any help from external resources. As I came up with this problem in my head a couple of days ago I realized that I should stop thinking (and hopefully reach nirvana) because this problem is driving me crazy.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|