|
Call IsWow64Process() to tell if the OS is 32-bit or 64-bit.
|
|
|
|
|
As a hack you could use sizeof(int*) (any type will do, not just int).
Or, sizeof(int) for 16/32.
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Hi,
I have a control which is using GDI+ and window region.
The below code is used for setting the window region.
GraphicsPath gp;
Region rgn( &gp );
Graphics g( hdc );
HRGN hRgn = rgn.GetHRGN( &g );
SetWindowRgn( hRgn, FALSE );
And in the OnPaint, the following is used for drawing the border.
GraphicsPath gp;
LinearGradientBrush brush( ... );
Pen pen( &brush, 1 );
Graphics g( hdc );
g.DrawPath( &pen, &gp );
The issue is that there is a slight difference between the drawn path and the set region. That means the path is not exactly fit in the window region. There are some gaps in many places. So drawing cannot be perfect. I am seeking for a solution to this, as CDC::FrameRgn do. I cant use this FrameRgn, since I need a gradient coloring in the path.
Thanks in advance.
- NS -
|
|
|
|
|
When you say does not fit, what are the effects?
Do you mean you've drawn the region using GDI and then with GDI+ and they are close but not exactly the same?
|
|
|
|
|
bob16972 wrote: you've drawn the region using GDI and then with GDI+
Nop... the window region set is a little bit different than the path drawn by using GDI+. So there are some holes (area that's not drawn) in the edges of the window.
- NS -
|
|
|
|
|
I have encountered Access violation reading location with this code:
IConverterSession* sample;
sample = NULL;
IStream *istream;
istream = 0;
sample->SetEncoding(IET_QP);
sample->SetSaveFormat(SAVE_RFC822);
hResult = sample->MAPIToMIMEStm(LPMESSAGE(msgName.c_str()), istream, CCSF_SMTP);
if (hResult !=S_OK){
throw(HResultException("MAPIToMIMEStm ResolveMsg",0));
}
I am really new to this can anyone guide me in making this work?
Thanks a lot,
Jj
|
|
|
|
|
sample = NULL;<br />
....<br />
sample->SetEncoding(IET_QP);
Guess what will happen when you call a function on a NULL pointer ?
You first need to create an object (do you need to use pointers here, can't you simply create an instance of IConverterSession ?)
By the way, the debugger is your best friend
|
|
|
|
|
I am using CWebBrowser2 wrapper in my dialog based application.
In the OnInitDialog() function I am calling Navigate() function of CWebBrowser2.
If the internet connection is not available on a machine then how can I generally detect that so that I can display some default thing in CWebBrowser2 control.
Can it be detected using CWebBrowser2 ?
Thanks.
|
|
|
|
|
At least you can realize a ping on a specific server.
Propably the CWebBrowser2 has this function...
Good luck
|
|
|
|
|
baerten wrote: At least you can realize a ping on a specific server.
Pinging a machine is not reliable. Too many false-positives.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
That's right, but in case of no internet connection you have all the time a false result.
But it's anyway the latest possibility LOL
|
|
|
|
|
If you have a dial-up, the attempt to query an IP will cause the ISP authentication junk (dialog boxes) to kick in. We tried this back in 2002 and soon realized it caused too many issues on laptops that needed to connect at locations with modems but weren't connected at the time the software was being run.
You need to check the routing table, then maybe attempt a ping after you know there is some network connection.
There are a couple of different approaches to check for network connectivity before attempting to go out and touch another computer.
|
|
|
|
|
DavidCrow wrote: Pinging a machine is not reliable. Too many false-positives.
You mean false-negatives? ICMP-requests to a live server filtererd out by a firewall?
You need to pick a server with ICMP running and not prone to stop that. I use "www.heise.de" for that. A german publisher of computer magazins with a very dedicated opinion on why ICMP-filterung is bad.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
jhwurmbach wrote: You mean false-negatives?
Thanks.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Or, a slightly more complicated way from Edwin Eefting &
Patrick Philippot posted on CodeGuru a while ago that appears to be fairly robust
Network connection[^]
|
|
|
|
|
ccpptrain wrote: If the internet connection is not available on a machine then how can I generally detect that...
See if this helps.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
My code tries to map a file with createFileMapping(). The Problem is
when the file is not present, this function fails with GetLastErr saying
"The Volume for a file has been externally altered". I am attaching code sample:
HANDLE hCreateFile = CreateFile( _T("E:\\size0.txt"),
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ,
NULL,
OPEN_ALWAYS ,
FILE_ATTRIBUTE_NORMAL,
NULL
);<br />
<br />
if( INVALID_HANDLE_VALUE == hCreateFile )<br />
{ err handling }<br />
HANDLE hFileMap = CreateFileMapping( hCreateFile,
NULL,
PAGE_READWRITE,
0,
0,
NULL
);<br />
<br />
if( NULL == hFileMap )
{ errHandling() }
How can I map a file with 0 Size? pls help
regds,
vinod
|
|
|
|
|
Vinod CS wrote: How can I map a file with 0 Size? pls help
How much do u expect the shared memory size to be after mapping? 0 bytes?
|
|
|
|
|
Acttually I want to append data to this file. But in the function where I am opening map of this file, I do not know how many bytes to append?
Vinod.C.S
|
|
|
|
|
From Jeffrey Richter's book ....
If you want to create the file-mapping object so that it reflects the current size of the file, you can pass 0 for both parameters. If you intend only to read from the file or to access the file without changing its size, pass 0 for both parameters. If you intend to append data to the file, you will want to choose a maximum file size that leaves you some breathing room. If the file on disk currently contains 0 bytes, you can't pass two zeros to CreateFileMapping's dwMaximumSizeHigh and dwMaximumSizeLow parameters. Doing so tells the system that you want a file-mapping object with 0 bytes of storage in it. This is an error and CreateFileMapping will return NULL.
Since you are using PAGE_READWRITE in CreateFileMapping....Your intension might be to write something in file whose size you have given to be 0 in CreateFileMapping.
I think you can map (using flag PAGE_READWRITE)file whose size is zero by specifying some number > 0 as dwMaximumSizeLow parameter of CreateFileMapping(). This number will be equal to no.of bytes that you want to write to file. The file will be expanded to that size if its size was initially zero.
bye.
|
|
|
|
|
thanks, I got the solution. I opened file with 1KB, if the file size is zero.
-- modified at 3:48 Wednesday 12th September, 2007
Vinod.C.S
|
|
|
|
|
Hi All,
I am writing an application which try to show PNG file as a dialog background using GDI+
I have successfully using the PNG as background (using Graphics::DrawImage() ), however, I found that the loaded PNG seems not apply the alpha channel information. What I should do?
Thanks!
(sorry for repeat posting if there is any)
Vincent
|
|
|
|
|
Where in your code are you calling DrawImage()?
What is the background behind the image and how is it drawn?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I called it at OnEraseBackground()
I would like to have a transparent background (i.e. I set the desktop background to black/white, I hope the image boundary will be "blur" with the work of alpha bending).
I am not sure if what I do is right, however, with using the Graphics::SetCompositingMode() , it seems that the Graphics::DrawImage() method will not directly apply the alpha bending information? ( I use Bitmap::GetPixelFormat() to verify the input image is a PixelFormat32bppARGB type, which means it should include the alpha channel)
|
|
|
|