|
Can someone give me hint
howto create an animation
control that keeps playing
while the main program
executes some lenghty
calculations, let's say
for (int i=0; i<10000000000; i++)
sum+=i;
(i know! it's only an example!!)
I createad an animation control
the standard way (with timer)
which didn't work of course,
and one other in an extra thread,
which i excpected to work,
but it stopped also during the loop!
Didn't anyone have the same
problem yet? Putting getmessage/
translate/dispatch into the
loop is not the right solution
for me! Do i have to create
an extra process for this?
Doesn't seem so elegant!
Thank you
|
|
|
|
|
OK. I have a project (a DLL written in C) that communicates over USB from the PC to a device. It works great, but I need the ability to turn off a progress dialog that I call with the DialogBox function. In other words, I want to be able to transfer data without showing any user interface. I've thought about ways to do this...create a thread, hide the dialog, etc. The problem is, I don't know how to respond to the WM messages (specifically WM_TIMER) if I don't have the UI. I have an API call that is called by an external program, which calls a routine with the DialogBox API. The DialogBox API has a callback procedure that I can process these messages in. So how do I have this API work without a dialog? Do I have to do a PeekMessage or something? It's been a while since I've programmed in straight C for Windows.
Brigg Thorp
Software Engineer
Timex Corporation
|
|
|
|
|
I think you are out of luck. If the API requires the dialog you can just try to make the dialog invisible (calling ShowWindow(...). Then messages like WM_TIMER will still pass through while the user does not see the dialog anymore.
You can also use AttachThreadInput if you want to get into more "intimate" contact with the dialog's message processing.
I keep submitting “VB” as a Priority-1 bug, but apparently no one here knows how to fix it. Nick Hodapp, Semicolon
|
|
|
|
|
I was actually able to get it to work by calling SetTimer before I start communication. I use a callback for the timer event instead of a Windows message which gets fired every time the timer expires. I do the following when the API is called in the DLL from the user's application:
SetTimer(hWnd, IDT_TIMER1, TIMER_INTERVAL, (TIMERPROC)HiddenSendDataProc);
MSG msg;
while (GetMessage(&msg,
NULL,
NULL,
NULL)
!= 0 && GetMessage(&msg, NULL, NULL, NULL) != -1)
{
if (msg.message == WM_TIMER)
{
msg.hwnd = hWnd;
HiddenSendDataProc(hWnd, WM_TIMER, 0, 0);
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
It works!
Brigg Thorp
Software Engineer
Timex Corporation
|
|
|
|
|
How to change the background color of a static text control (IDC_STATIC ) in a dialog?
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Look up WM_CTLCOLOR on MSDN.
Michael
Life’s not a song.
Life isn’t bliss.
Life is just this.
It’s living. -- Buffy the Vampire Slayer: Once more, with feeling
|
|
|
|
|
Hi!
I've encounter the following problem!
<br />
Writec pseudo code using semaphore function wait and signal to solve the following problem:<br />
<br />
A computer system has a pool of N idential printer attached. Processes that wish to print must obtain an available printer. Write two functions:<br />
<br />
int getPrinter(void);<br />
void releasePrinter(int printerID);<br />
<br />
getPrinter obtains an availble printer from the pool of N printers and return the printer number (0 to N-1) as its result. releasePrinter takes a printer number and makes it available for use by other processes.<br />
Here is what i attempt at it
#define N //number of printer;
int numberOfPrinter = N;
int printer[N] //array of N printer;
getPrinter(void)
{
if numberOfPrinter > 0 Then
set printer[numberOfPrinter-1] = used
return numberOfPrinter-1
else
Block
}
releasePrinter(int printerID)
{
numberOfPrinter++;
set printer[printerID] = not used
}
Could you please give me any comment or any advise regarding above problem!
Thanks
|
|
|
|
|
<no_homework_rant>
The purpose of this forum is to help answer programming questions related to Visual C++, not to find people to do your homework for you!
</no_homework_rant>
Software Zen: delete this;
|
|
|
|
|
How to make that a list control (CListCtrl ) never lost the focus?
I have a dialog with a list control and some buttons, and I want that the list box never lost the focus. When I click on any control or on the dialog, the focus will be holed by the list control.
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
First, this is a bad idea. Redesign your app.
Second, process the WM_SETFOCUS, WM_KILLFOCUS messages in all your dialogs controls if you really need to ignore all UI guidelines.
I keep submitting “VB” as a Priority-1 bug, but apparently no one here knows how to fix it. Nick Hodapp, Semicolon
|
|
|
|
|
In win32, what mechanism allow procesess to share a region of memory? The only method i'm aware of is MapViewOfFile() ?? Is there any idea?
Thanks
|
|
|
|
|
Anonymous wrote:
The only method i'm aware of is MapViewOfFile() ?? Is there any idea?
That will create a memory mapped file which is the best method for doing any sort of high speed communication or communication that may create a large number of buffers.
Or you could use GlobalAlloc to create a HGLOBALs with the GMEM_MOVEABLE flag set. This will allocate memory in the pages that are shared across all processes. You will only need to call GlobalLock in order to gain access to the memory from another process. One of the difficulties with this method is that you will need to send a message or do something else to transfer the handle of the HGLOBAL between your two processes.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
|
What kind of reports can use in VC instead of Crystal?
Do u know ones?
|
|
|
|
|
Hi!
I have the following instruction:
1)Disable all interupts
2) Read the time of day clock
3)Set the time of day clock
4)Change memory map
What of the above instruction should be only allowed in the kernel mode!
I've come with solution is that number 1 should only be allow in the kernel mode. However i dont quite get "change memory map" meaning. Could anyone plse perhap explain the term and give comment about the above question!
Regard,
|
|
|
|
|
I dont understand the context for this question, so it seems to me that there is not enough information to answer your question. Do you know what your memory map is for, or who creates it?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Under Vc++ 6.0 and MFC, how can I set items' images of the toolbar.These images were saved as .bmp or .ico. And I known how to load the .bmp to CBitmap.
Help me!!!
Help me!!!
Help me!!!
|
|
|
|
|
Try this:
CToolBar::LoadBitmap()
CToolBar::SetBitmap()
or call CToolBar::GetToolBarCtrl()
And then access single items – more: CToolBarCtrl member functions
Viliam
|
|
|
|
|
I means that one item have its own one image.
A toolbar has several images, not one bitmap to all items.
|
|
|
|
|
I've got this for my tute question!
A large organisation has offices in several countries around the world. Explain why it is desireable for the organisation's directory service to be "multi-master"
Could any one please enlighten me! Thanks.
|
|
|
|
|
Huh ?! I assume that it got to be related to the Active Directory thing, just read about it, it's bound to be explained somewhere in there .
Max.
|
|
|
|
|
I'm trying to generate a short delay of just a few ms, which I need because I am controling a box on the serial port which is very slow and the input is un-buffered so I need to pad the data.
I am using Sleep(x), where x is the number of ms. However, I get a much longer delay than I need, ie Sleep(1) gives me 70ms!
Anyone got any ideas of how I can generate a short delay reliably?
Thanks,
Ali
|
|
|
|
|
You can try Sleep(0), it causes the thread "to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run."
Vagif Abilov
MCP (Visual C++)
Oslo, Norway
Hex is for sissies. Real men use binary. And the most hardcore types use only zeros - uppercase zeros and lowercase zeros.
Tomasz Sowinski
|
|
|
|
|
Thanks for the suggestion, I'm not sure it will give consistent enough results - I'll look in to it though.
Thanks,
Ali
|
|
|
|
|
You didn't say what operating system you were using. I doesn't answer your question, but you may find the following article interesting...
http://www.codeproject.com/system/simpletime.asp
Gary Kirkham
A working Program is one that has only unobserved bugs
|
|
|
|