|
Dear all,
Can I use "typedef" with "class" ? (For some reason, I want to use "class" CA instead of "struct"..so..)
I mean, if I wrote the following things:
class CA
{
// omit
};
typedef CA* LPA;
I always got compile error like this:
error C2040: 'LPA': 'class CA' differs in levels of indirection from 'void ** '
How can I correct this error ? Anybody help me ?
Thanks a lot !
|
|
|
|
|
In my original program, I wrote:
class CRGBImage
{
// omit
};
typedef CRGBImage* PHANDLE;
So, I always got a compile error...
But, when I modified this line "typedef CRGBImage* PHANDLE;"
to:
typedef CRGBImage* PRINTHANDLE;
Then, everything is OK !!
Is PHANDLE a "reserved word" for MFC or Win32 SDK ?
|
|
|
|
|
Well, since HANDLE is a Win32 type, I'd expect PHANDLE (and LPHANDLE) to be typedef'ed.
--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.
|
|
|
|
|
True. A search for PHANDLE in Edit/Find and Replace/Find in Files with include directories setting gives
WinNT.h(288):typedef HANDLE *PHANDLE;
FaxDev.h(190):typedef BOOL (WINAPI *PFAXDEVSTARTJOB) (HLINE,DWORD,PHANDLE,HANDLE,ULONG_PTR);
|
|
|
|
|
How can a person use ASP pages and VBScript in a client side application, instead of just using html pages?
Nothing is impossible, It's merely a question of figuring out HOW?
|
|
|
|
|
|
I have a dll that launches a window from it. I do not want people to see the window it launches, instead I want the paint functions to be redirected to a Static box that I will place in my application. Does anyone know what I should look up or have any idea how this can be accomplished? Any help is appreciated!!!
Nothing is impossible, It's merely a question of figuring out HOW?
|
|
|
|
|
Why don't you just call ShowWindow( SW_HIDE ); on the window?
|
|
|
|
|
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
|
|
|
|