|
Anonymous wrote:
Q. Where's the code that adds them?
In the project's .rc file.
Anonymous wrote:
What's a newbie got to do to get with this stuff?
Start off small and practice.
Anonymous wrote:
Q. Are there any tutorials that describe step by step application UI development with screenshots or explain what the Class Wizard does and how somethings done there can be undone?
Most start with MSDN's Scribble example. It's a very comprehensive tutorial.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hi i am working with the following code. however anytime i size it larger or smaller horizonitly the tree view continies to shrink horizontily waht am i doing wrong?
ive tried both getwindowrect and getclientrect and neither do the job
also as you can see i want it to remain attached to the left side of the window and to just resize verticly wich works fine. can anyone help me?
<br />
CRect rect, rect2, rect1;<br />
<br />
GetClientRect(&rect);<br />
<br />
tree.GetClientRect(&rect2);<br />
<br />
rect1.top = rect.top+24;<br />
rect1.left = rect.left;<br />
rect1.right = rect.right+rect2.Width();<br />
rect1.bottom = rect.bottom;<br />
<br />
tree.MoveWindow(rect1);<br />
|
|
|
|
|
The problem is that MoveWindow() works in window coordinates, but GetClientRect() doesn't return the full size of the window, only the client area. It doesn't include the borders, or the scrollbars or anything else in the non-client area. Change tree.GetClientRect() to tree.GetWindowRect() and it should work nicely.
Ryan "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"
|
|
|
|
|
Hai,
I want to print % symbol in my printf statement..
eg : printf(" Error is %.2f %",val); ie it should print Error is 5.00%
How should I do this??
thanks.
|
|
|
|
|
in order to print a % use \% if you wannt print a \ do \\ or a quote mark would be \"
they are all escape sequances similar to \n or \r
|
|
|
|
|
Using %% in the format string will output a single % symbol. So your format string should be " Error is %.2f %%" .
Ryan "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"
|
|
|
|
|
Or use %c in the format string
printf(" Error is %.2f %c",val,'%');
Regards,
Andrzej Markowski
|
|
|
|
|
Hi
I am creating a simple movie player with VC++ 6, and I am planning to create a custom control in the GUI for its seeking purpose (I want to be able to modify the color and look of the seeking bar). I am unsure though, which control should I inherit from for this purpose, CSliderCtrl or CProgressCtrl? CProgressCtrl seems appropriate because the seeking bar is periodically updated when the movie is playing, however, I also want the user to move the seeking bars, something which is provided by CSliderCtrl. Could someone help me on this? Or is there another control which is more appropriate than the two?
Thanks!
|
|
|
|
|
i would use the slider control thats just my opinion since it can do anything the progress control can do it just looks different but if your gonna make it owner drawn anyways then why should it matter :P
|
|
|
|
|
I agree with the other reply. Use the CSliderCtrl and make it owner draw so it looks nicer
Ryan "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"
|
|
|
|
|
Hi,
I like ask you about an issue with the threads...
I'm working in a GUI app with threads what creates windows (2 threads & 2 windows) and i don't know how manage their respective message loops;
I was created a loop for each window...
but the trouble is when the second window (a child window in the surface of the first window) is refreshed, more exactly when i drag it to an area non visible of the screen (coords -50x, -50y f.e.) and then i drag it to an visible area, the window have vertical lines with the parent window color, and i don't know how i can solve it... ((
Please if someone cal help my I'll thank you
PS: I'm not english forgive me my bad english
|
|
|
|
|
Hi,
Have a look at this article
http://www.codetools.com/threads/usinguithreads.asp
Sujan
|
|
|
|
|
Hi Sujan,
Thank you for your answer.
I had do how you told me, but I'm trying to do it without the MFC, the trouble is what i've refresh problems in the child window, i think what it's because i must wait in the message loop, with any function as WaitForMultipleObjects as the MSDN says, but i don't know how i can implement it, i really want to know how i can solve that problem
|
|
|
|
|
You need to use MsgWaitForMultipleObjects and when you get messages, they are processed by your message loop. If you only use WaitForMultipleObjects, then when WM_PAINT and other messages show up for your second window, they are not processed until your thread is unblocked by some other event it was waiting upon. You can look at the MFC code to see how they do this with their main message pumping loops, and you could mimic something like that.
Otherwise, when you get WAIT_OBJECT_0 + nCount you need to process messages with GetMessage, TranslateMessage and DispatchMessage.
This way, your thread either waits on one of its events, or unblocks when messages are available for the window to process.
|
|
|
|
|
Thank you Blake, now excuse me, but can you explain me what are the objects what i'must put in the 2nd argv.
Please!!! i don,t understand too much about how it works.
What i must create to take the respective handle??
Thanks
|
|
|
|
|
The first argument is how many handles are in the array passed to the second argument.
The handles are handles to 'waitable' objects such as mutex, event, semaphore, thread handle, process handle, etc.
The MsgWaitForMultipleObjectsEx function can specify handles of any of the following object types in the pHandles array: Event,Mutex, Critical section, Semaphore, Process, Thread
|
|
|
|
|
Blake,
then you are trying to tell me what i can use the handle of the first thread for this function, no??
amonng another things what i can use?
Please can you give me an example of that please!!!
I'm to much grateful, THANK YOU!!!
|
|
|
|
|
If you are waiting on a thread or process handle, they are not 'signaled' until the thread or process exits. You can wait on a process handle from a call to CreateProcess, for exmaple, to detect that the created process has terminated. If the main thread of oyur program creates one or more secondary threads, you can put the thread handles into an array, and be 'signaled' when one of the threads exits. However, since you said your thread also made a window, you need to use MsgWaitForMultipleObjects so that your thread can process the window messages.
|
|
|
|
|
Excuse me again...
But if i've 3 threads and these 3 threads creates windows with their own message loop; how can i implement it in the loops of these windows, because if i'm not mistaken these threads never ends and so their never will be signaled, then i must create a timer or another thing but which is the best option to use?
|
|
|
|
|
One of the handles the MsgWaitForMultipleObjects waits upon can be an event that the main thread of your progrma will set. When each event is signaled, then each thread can post a WM_CLOSE to its window. When the window closes, the thread detects that (maybe the window sets a thread-specific variable) and then the thread exits. When all threads have exited, then the main progrma thread will exit. The main program thread can be waiting for the thread handles to be signaled, indicating the working threads have all exited. That is why they have MsgWaitForMultipleObjects, so you can have several different signals a thread is waiting for. You need to have the worker thread waiting for its 'do the work' signal (if there is one, otherwise it is just servicing the window) and at least wait on an event that the main thread sets to let the working thread know to exit.
When the working thread is processing the messages, using GetMessage, TranslateMessage, and DispatchMessage, the message will reach the correct window, so you don't have to worry about that.
Another way to get a thread to exit is to use PostThreadMessage, if you know the thread is processing messages, and you can post a specifc message that the thread can intercept to know it is time to exit. You can tell it is a thread-targeted message when you call GetMessage, because the 'hwnd' member of the MSG data structure will be NULL.
|
|
|
|
|
How do I do this? I have an application that uses GetCursorPos() to get the current mouse position, but I want to send it my own coordinates.
|
|
|
|
|
Is this what you are looking for?
SetCursorPos(int x, int y);
humpa humpa
|
|
|
|
|
No, I don't want to just do SetCursorPos (unless I did it inside of GetCursorPos, but that would be pointless) because the application calls it very often, and that results in the mouse shaking.
EDIT: Don't worry about the shaking, all I want to know is how to hook GetCursorPos()
|
|
|
|
|
Nevermind, I figured it out on my own.. I just had to hook GetProcAddress and check if the proc was "GetCursorPos", then save the pointer to the origonal and return mine.
|
|
|
|
|
As the subject said, I´m having troubles with my dialogbox. I cant move it .
This is what I´ve written:
IDD_DIALOG1 DIALOGEX 0, 0, 196, 102
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,139,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,139,24,50,14
END
----------------------------------
WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR CmdLine, int CmdShow)
{
...
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG1), hWnd, (DLGPROC)DlgProc);
...
}
----------------------------------
bool CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_INITDIALOG:
return true;
case WM_MOVE:
break;
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
case IDOK:
EndDialog(hWnd,0);
return TRUE;
case IDCANCEL:
break;
}
break;
}
default:
return false;
}
return true;
}
I can use the buttons and shutdown the dialogbox. As I said, I just cant move it.
I´m using VS.NET 2003, any suggestions would be helpful.
Thanks.
|
|
|
|
|