|
Hello,
I am working on a simple program that must load a bitmap and then resize the window that the bitmap is displayed in so that it is the exact size of the bitmap. The program appears to work fine, except for one small problem. When Windows redraws the window that has now been resized, the border on both the right hand side and the bottom do not get drawn. Also, it appears that the orignal "X" box that closes the program is still there. However, if I resize the window manually after the computer has redrwan the window, both borders appear and the old "X" box disappears. Anyone have any idea how I can go about fixing this problem?
Thanks,
Joe
|
|
|
|
|
SetWindowPos has a flag to indicate that the non-client area of the window needs updating. You can either use SetWindowPos to do the resize (if you are not already using SetWindowPos), or you can do something like the following just to force the frame to redraw:
SetWindowPos( Your_HWND_Here, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_DRAWFRAME );
Good luck,
Chris Richardson
|
|
|
|
|
Any ideas on what functions I need to use to retrieve a handle from an active window and edit that window (drawing, outputting text, etc..) maybe for a game or other form using Win32 API?
Thanks....
P.S. I'm using Visual.Net 2003/2005 as a platform!
|
|
|
|
|
Do you need to handle or hwnd of a window?
|
|
|
|
|
It's a hWnd for a window. I've tried to use SetWindowsHookEx and LoadLibrary, but they do not seem to do anything. I don't know if I am using them quite right or not, or either SetWindowHookEx is only used for mouse and keyboard hooking or what. Maybe hooking applications is too advance for SetWindowHookEx. I really dunno.
|
|
|
|
|
I dont know its purpose or no but you can use FindWindow did you try it
|
|
|
|
|
Yes, it have used it. But I used FindWindowEx instead. It retrieves the hWnd of a window based on the class name for that particular application. That is a piece of the puzzle but not the whole thing. Now, I'm trying to use that hWnd and SetWindowsHookEx to hook it to that particular window, but I'm having no luck.
|
|
|
|
|
See here[^] for hook maybe its some helpful for you
|
|
|
|
|
Abu Mami's Easy Installer files that I downloaded DID NOT include any ".clw" or ".dsw" or ".dsp" files. can someone send them to me. Also, how are you to compile the Easy Installer or change some of the coding without being able to load it into the IDE (using VS 6.0)
A C++ programming language novice, but striving to learn
|
|
|
|
|
.clw and .dsp are not source files... why would they be included ?
|
|
|
|
|
You're right about the .CLW file but the .DSP file (or its VS.NET counterpart) is the equivalent of a make file and would be needed to build the project.
Steve
|
|
|
|
|
It's a VS.Net project, so it uses a .sln and a .vcproj instead of .dsw
|
|
|
|
|
I don't suppose there is a VS 6.0 version of Easy Installer. If, not is there anyway I can change something to get it into the VS 6.0 IDE?
A C++ programming language novice, but striving to learn
|
|
|
|
|
Hi all,
I need do open a "please wait" window in order to keep blocked my MFC application (i mean that the user can do nothing) until a time-expensive routine ends. Then i need to close this "please wait" window.
I need a modal dialog i suppose.
How can i do that ?
Should i launch the time-expensive routine from the modal dialog ?
Thanx in advance,
Desmo16.
|
|
|
|
|
All you need to do is create a new dialog window, open it before runnning your expensive routine and close it after. In my opinion, having a "please wait" and forcing your user to sit there twiddling there thumbs is bad programming. Why not use a thread instead?
|
|
|
|
|
yes and no, if you create a Modal dialog, your long task will not be done unless you make it part of the dialog itself.
waldermort wrote: and forcing your user to sit there twiddling there thumbs is bad programming. Why not use a thread instead?
There are some tasks in some software that will ALWAYS make a user wait, whether it's in a different thread or not.
|
|
|
|
|
Because the user knows he has to wait so long and he wants the results that can be shown only AFTER the computation in the routine.
( The routine i'm talkin' about is a multi-objective genetic algorithm that finds a pareto-front of
solution after searching the causative bodies of seismic/volcanic effetcs)
|
|
|
|
|
Desmo16 wrote: The routine i'm talkin' about is a multi-objective genetic algorithm that finds a pareto-front of
solution after searching the causative bodies of seismic/volcanic effetcs
Ohhh this is gonna be my new sig...
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I think you can see an example on http://www.codersource.net/ about this object but i cant remember its name.
|
|
|
|
|
I have two addins installed in my Outlook 2003, both have their specific functionality, I would like to integrate the functionality of both thru global mouse hooks, here is my senerio
1) Lets say there is a button "abc" on toolbar "A" in outlook mail composing window
2) and there is a button "xyz" on toolbar "X" in the same mail composing window
3) on click of button "abc", I would like to generate click of button "xyz" first
4) and then resume back to the process of button "abc"
I am thinking of developing application using VC++ and creating global mouse hooks (may be there is some better approach), I know I can capture the mouse click but my questions are
1) how do I know that the click that was captured is for "abc" button....I think I'll have to determine if the click was for OUTLOOK main window and then determine which mail composing window the click was for, and then finally determine which toolbar/button was it for........but how do I do this all ? any ideas/pointers/suggestions
2) Once I know that the click was for button "abc" now second step is, how do I push a new click event in the windows queue for button "xyz" in toolbar "X"
Also one thing to note is, there may be multiple mail composing windows open but we got to work on the active one only which initiated the click event in question.
Thanks in advance.
|
|
|
|
|
In my opinion, mouse hooks won't help you in this scenario. Write a COM addin or use VBA. It will be much simpler.
Obstacles are those frightful things you see when you take your eyes off your goal.
|
|
|
|
|
Hi,
does anyone know how I can convert a IntPtr of a HWND object to the data type HANDLE ??
I want to register the window Form1 to receive PnP Messages from a USB API from cypress:
USBDevice = new CCyUSBDevice(Form1->Handle);
CCyUSBDevice expects HANDLE, but I get only IntPtr from my Form1....
Please help me!
maggi01
|
|
|
|
|
HWND s and HANDLE s are distinct objects: there is no meaningful conversion between them.
Steve
|
|
|
|
|
Actually my code goes like this:
<br />
namespace Test_Application<br />
{<br />
using namespace System;<br />
using namespace System::ComponentModel;<br />
using namespace System::Collections;<br />
using namespace System::Windows::Forms;<br />
using namespace System::Data;<br />
using namespace System::Drawing;<br />
using namespace System::IO;<br />
<br />
public __gc class Form1 : public System::Windows::Forms::Form<br />
{<br />
public:<br />
static CCyUSBDevice *USBDevice = new CCyUSBDevice(EnumWindows((HANDLE)this::Form1::Handle));<br />
.<br />
.<br />
.<br />
How do you propose to deliver a handle of my "Test_Application" to the CCyUSBDevice constructor... which expects datatype HANDLE !?
thanx for your answer,
maggi01
|
|
|
|