|
If I do use ShowWindow(SW_HIDE) to hide the unwanted window, how can I redirect the WM_PAINT messages to my new StaticBox?
Nothing is impossible, It's merely a question of figuring out HOW?
|
|
|
|
|
Some things are impossible. I think you've hit on one of them.
This is not simply a matter of redirecting WM_PAINT messages; you want a window in your app to display the contents of another, hidden window in a DLL. If it's possible, it will certainly be hellishly difficult.
|
|
|
|
|
What exactly are you trying to do? Are you trying to draw the contents of the window in the static box? If so, there are other ways of accomplishing that other than redirecting WM_PAINT messages. Give me details on what exactly you are trying to accomplish, and I'll help how i can.
D
|
|
|
|
|
Okay what I am trying to do is draw the contents of a window into my static box. My application loads a dll file and calls a function Init() in this dll. That Init() function will then Create its own window to draw in. Then when this window needs updating, I will call Render(...,...) and pass in the required parameters. The Render function from the DLL will the perform its calculations and then draw the result into the Window that it created when Init() was called. The DLL's containing these Init() and Render() functions are created by users so I will have no way of knowing what window class name the user created their external window with. I am trying to find a way to Hide that Window that is created in the Init() part of their dll, and then to draw its picture into my static box on my application each time I call Render(). I thought maybe I could do this by hiding the window and redirecting the WM_PAINT messages, but there are two problems with this, 1) a hidden window gets no paint messages and 2) I will not know what to paint since this is pre-determined by the user's DLL Render function. I thought I could do it with a bitmap srccpy and then paste it into my static box, but then I still have to have a way to hide the window. This Render function may get called upwards of 16 times per second so using ShowWindow(SW_HIDE) and ShowWindow(SW_SHOW) is not an option. I can use EnumDesktopWindows along with (HMODULE)GetWindowLong(hwnd,GWL_HINSTANCE) and compare this with GetModuleHandle("users.dll") to see if I have the window handle created by the user's dll Init() function. After I have the HWND by enumerating the windows, I now need to figure out how to hide the window, and then paint the contents into my static box every time the Render() function is called. The function names will always be the same, however the windows created and contents drawn inside these functions will vary depending on the user's dll file.
Nothing is impossible, It's merely a question of figuring out HOW?
|
|
|
|
|
Aqiruse wrote:
Nothing is impossible, It's merely a question of figuring out HOW?
It's more a question of why. Why not have the the dll render into/onto a bitmap which then is displayed by your application? Much more sane and easy.
Joel Lucsy (jjlucsy@concentric.net)
|
|
|
|
|
Aqiruse wrote:
Then when this window needs updating, I will call Render(...,...) and pass in the required parameters.
Why don't you make one of the required parameters for your Render(...,...) method be the HWND to the static box(or CWnd* if you are using MFC), or a memory device context? Maybe even a pointer to a bitmap which you have preacllocated. In your static box's WM_PAINT handler, just call the dll's Render function. Done.
|
|
|
|
|
Invisible window doesn't get WM_PAINT messages, what you want to redirect?
|
|
|
|
|
I know how to activate a dial-up modem connection to the Internet using WinInet (see my article on MSDN about it), but how do I show the dialog box
This is the one that pops up after you open IE, it dials in automatically for you, and then when you close IE, the dialog above shows. What API do I call for that, or do you think it's an IE thing?
Thanks.
Sincerely Yours,
Brian Hart
"And that's the news from Lake Wobegon, where all the women are strong, the men are good-looking, and the children are above-average." - Garrison Keillor
|
|
|
|
|
|
Hi.
I am stuck with an intesting problem with the string library. Let say declare a string (empty). To start out, I append a statement. Afterward, I want to append an integer and end it with a char. For example:
string strTemp;
for (int i = 0; i < 5; ++i)
{
strTemp += "Count down: ";
strTemp += i; // Problem!
strTemp += '...";
cout << strTemp.c_str() << endl;
}
The output of the code above will looking something like:
Cout download: *character that 0 represents*
Cout download: *character that 1 represents*
Cout download: *character that 2 represents*
Cout download: *character that 3 represents*
Cout download: *character that 4 represents*
The output I want is:
Cout download: 0
Cout download: 1
Cout download: 2
Cout download: 3
Cout download: 4
Is there a way to append or concatenate an integer into a string variable and have the string variable store the integer as an integer instead of the ACSII character the integer represents?
Thanks,
Kuphryn
P.S. I experience the same problem with STL container. Furthermore, the problem remains even if I switch from a string to a vector<int>. It seems the two do not mix.
|
|
|
|
|
Use a stringstream:
#include <sstream>
stringstream strm;
strm << "Count down: " << i << "other stuff" << ends;
cout << strm.str().c_str() << endl;
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Nice!!!
Someone posted about ostringstream at Arc Technica. ostringstream works great.
What is the difference between:
- stringstream
- ostringstream
- istringstream
Kuphryn
|
|
|
|
|
Why does this code work?:
char test[12], test1[12];
....more code...
fscanf(fp,"%d %s %s %s %s",&hour,station,country,test,test1);
And this doesn`t:
CString test, test1;
....more code...
fscanf(fp,"%d %s %s %s %s",&hour,station,country,test,test1);
The CString values are correct just after the 'fscanf', but they disappear after some other function calls.
|
|
|
|
|
You are directly modifying the contents of the CString without locking the buffer first.
CString test, test1;
LPTSTR pszBuff, pszBuff1;
pszBuff = test.GetBuffer(12);
pszBuff1 = test1.GetBuffer(12); Now you can use pszBuff/pszBuff1 in fscanf(). Call ReleaseBuffer() on both CStrings once you're done directly modifying the contents.
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Thank you, so much. And then if I modify the values in many places, this way: if (...) test="some word", and so on... What must I do? Have I to make a GetBuffer before modifying it and ReleaseBuffer after each one?
|
|
|
|
|
José Luis Sogorb wrote:
Have I to make a GetBuffer before modifying it and ReleaseBuffer after each one?
Yep. See the docs on CString::GetBuffer() for some examples.
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Hi all,
Please introduce to me all functions or classes in C++ or VC++ about sending or reciving bits to special address in LPT port !
Please help me
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I am using an owner draw ListView and I have a need to display the vertical and horizontal scrollbars at all times. I've tried passing the WS_HSCROLL and WS_VSCROLL style bits to CWnd::CreateEx, but to no avail. I have been able to get the desired result by setting the control's style in response to a WM_SIZE message, however this is very inefficent.
Does anybody know a more direct way of always displaying the scrolls in a ListView?
|
|
|
|
|
maybe you should set the range
one is the other who absorbs the thoughts of others
|
|
|
|
|
is it possible to download an add on to VC++ 6 that allows building of Linux/KDE programs? And are there any tutorials on the subject.
I am trying to create Linux counterparts for my windows MFC software.
Please help.
Jonny
.NET or not .NET? Bill has the answer......
|
|
|
|
|
|
Hi all
How to update my desktop ?
In API Windows
I use
HWND hwnd;
hwnd = GetDesktopWindow();
UpdateWindow(hwnd);
but nothing append
Can u help me please...
Thank u all
Leedoriden ( FR )
|
|
|
|
|
UpdateWindow() will repaint the parts of a window that are marked invalid (i.e. in need of repainting). You should first call Invalidate() to invalidate the desktop.
There's no need to call UpdateWindow(), since Windows will eventually send a WM_PAINT message to the desktop. However, if you want to force an immediate repaint, then call UpdateWindow() right after you call Invalidate().
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello!
I want to establish data sessions between 1 server and n-clients. The data communication would be progressing between 1 server and n-clients simultaneously.
i.e.one server and many clients.i.e. N client machines would be connecting and communicating with 1 server machine. Once the connection is established, server would be accepting the data sent by the clients and then the same data would be again sent back to the same client who sent it to the server, through modem. The application should have the capability to do data transmission and receive simulnateously with n-clients.
The application is supposed to run on Win 98,WinNT, WIN 2000 and Win XP. I am using C programming and TAPI 2.0. I do not want to use COM/DCOM. Can you please tell me if it is possible to build an application of n-clients and 1 server using language C, TAPI 2.0 and without COM/DCOM.
I already have built an application for data communication between single client and single server.
Data transmission is done through the COM port to which the modem is connected.
While programming for 1-server 1 client I have made use of async comm by using CreateEvent(), ReadFile(), WriteFile() (for communciation between COM ports), WaitforSingleObject() and GetOverlappedResult().
The configuration I am using is :
There is a modem connected to the server machine and there are n (say 4) client machines. Each client has a modem connected to it. The data communication is via the modem through the COM port to send and recieve data (data communication--> client to server back to client).
If suppose, the server is waiting for connection and a client connects to the server, the connection is established and the data communication is started. Now another client attempts to connect to the server, will that client be able to connect to server ?? (as the first client is still holding the line and busy in data communication).
Do I have to have some other specialised hardware so that other clients may also connect to server simultaneously. (same as in EPBX systems).
or do I need to have some software which will help me connect n-clients to 1 server.
Could you please guide me amd give some idea about how to go about solving this problem.
Your advise would be of great help to me.
Thanking you.
With Regards,
Sandeep Shetty
|
|
|
|
|
Hello All,
Anyone with a nice algorithm to randomly generate points in a polygon? Random points based on the bounding boxes are not working nicely.
Any help or tip?
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|