|
I found the solution on CodeGuru...
// extract :
When starting the print-dialog, a part of the code in the printerdriver is executed (setup/init, querying printer capabilities etc). This bit of code may have altered the FPU exception mask. The driver SHOULD reset the FPU exception mask but this is quite often omitted.
The safest bet would be to reset the FPU after calling the CPrintDialog:oModal.
_control87( _CW_DEFAULT, 0xfffff )
//
Executing this line
_control87( _CW_DEFAULT, 0xfffff )
before my paint code stops the crash.
JPG
|
|
|
|
|
Hi, i've been working on an IM app, and have been having some more trouble (i had a different problem yesterday) with using rich text, now i was messing around with adding images in (like the official msn messenger client and emoticons, which coincedentically also uses rich text) i tried using some code from knowledge base article (220844) but this code seems to leak memory, my working set increases by a few mb if i add and remove 50 images. The use of ole seems like total overkill for my purposes, if you've used the messenger client you'll know what i'm talking about, the closer i can get to this level of functionality in my rich text control the better.. any thoughts?
thanks.
|
|
|
|
|
Hi,
I ported my application(MFC with VC6) to XP. I used the mechanism of seperate manifest file in application directory .Refer MSDN article for "Using XP style" (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/xptheming.asp)
Now the problem is the Grip portion of the Toolbar is not getting repainted properly in XP.
Thanks in advance
Ajesh
|
|
|
|
|
Hi All,
I must be making this way too complicated. Could someone show me how to pass a TCHAR* or LPTSTR to a member function, allocate enough memory for an unknown string length, and have the string be there when it returns?
I feel like this is a stupid question, but just can't get it to work!
thanks
Paul
|
|
|
|
|
Hi..
many API functions that take char* as an argument takes the lenghth of the buffer as well..
you can do the same, pass the pointer and the length to the function...
|
|
|
|
|
Example is kind of C, in C++ you should probably use string class of some kind (_bstr_t, std::(w)string). NOTE The function does not check for 0 length.
bool member_function(LPCTSTR szSource, LPTSTR* szDestination)
{
if(!szSource)
return false;
size_t nSize = _tcslen(szSource);
*szDestination = new TCHAR[nSize+1];//NOTE: if passed string is not NULL, we just lost memory
_tcscpy(*szDestination, szSource);
return true;
}
|
|
|
|
|
but but but ....
won't I need to call delete on the new so that there is no memory leak? If so, it would seem foolish to delegate this to the caller of the function.
Paul
|
|
|
|
|
Hey, You did not ask if it was foolish, you ask how to do it
Actually, it is a design decision you have to make.
Deleting inside the function might present additional problems
1. What if the user of the function passes uninitialized pointer?
2. What if the user of the function passes the pointer which initialized to something that can not be deleted (_T("static string"))?
Windows APIs usually leave memory deallocation to the client of the function. But again - it is your decision.
|
|
|
|
|
thanks for your time !!!
Paul
|
|
|
|
|
Hi guys,
when I use out assembly like this
//MSDN Sample
__asm
{
mov al, 2
mov dx, 0xD007
out dx, al
}
in a function, every thing is ok and run under 98
but when I run this in Windows2000 I get error like:
Unhangled exeption in Test.exe : 0xc0000096: Privilaged Instruction.
please tell me , what I must do?
My program must work under win2000
Thanx before.
|
|
|
|
|
this is a very wild guess, but I think that the out instruction is privileged under NT systems (NT4, W2K as well as XP).
|
|
|
|
|
geo_m's wild guess is right: under NT-based OS'es (NT3.5-4, W2K, XP) you have no direct access to the hardware.
Generic devices (Serial port, LPT, etc.) can be accessed like files by using special names (See CreateFile documentation).
For custom devices, you'd need a device driver that runs in kernel mode and talks to the device, and you user mode program just talks to the driver. But writing a driver is a separate business alltogether...
Those who not hear the music think the dancers are mad. [sighist] [Agile Programming]
|
|
|
|
|
|
|
Congratulations, you just happened to be awarded th "I post a dumb thread and answer it" prize
~RaGE();
|
|
|
|
|
It's depressing to me that people this stupid can still work out how to use a computer. Bring back 1985, that's what I say.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
In a VC6 macro file (*.dsm), can I automatically assign a shortcut to a certain macro?
(e.g. in an "OnLoad" even or something...)
Those who not hear the music think the dancers are mad. [sighist] [Agile Programming]
|
|
|
|
|
Hi,
I added two CDialogBars to a CBRS_RIGHT vertical rebar, but neither they stretch to fit the frame height, nor the remaining space is erased. Everything is however fine when I lay this rebar onto the CBRS_BOTTOM
Are there any CCS, CBRS, RBS or RBBS flags I should additionally set?
Regards,
BB
|
|
|
|
|
1.How to find wheather the system is locked
2.how to find internet connectivity is there
Pl reply
|
|
|
|
|
hi,
1: check in network places if you can see other computers in the network the computer is not locked, if thats what u r looking for.
2: for internet connectivity go
start-> run-> ping www.codeproject.com -t will show you the real excahne of bytes and time taken. if request times out then there is no internet connectivity.
cheers,
Himanshu
|
|
|
|
|
I have a TreeView like "Favorites" in ie.
I want show the name of the web site like "CodeProject" and associate an URL "http://www.codeproject.com" who is hiding.
i think i can do this with setitemdata but the value associated is a DWORD i can't associate a CString .
if someone know how i can do ....
PS excuse my english
|
|
|
|
|
Put your CString in a table, list, vector, etc ... and save the index of the entry in the DWORD.
~RaGE();
|
|
|
|
|
thx
How can i convert a POSITION to DWORD ?
|
|
|
|
|
Maybe like this :
POSITION pos;
DWORD d=(DWORD)pos;
I'm not sure because i do not know how Windows handles POSITION, so it may be more complicated.
Why would you like to do such a thing ?
Pls note that a DWORD is a 32 bit value, so you can cast any kind of data into it and get them back after. You also can store pointers on structs into it. I consider the Data provided with CTreeCtrl to be used with indexes or pointers pointing on Data, not the Data itself.
~RaGE();
|
|
|
|
|
thx
i already try this solution but don't work
|
|
|
|