|
If you're using a microsoft compiler you might think about using #pragma once.
Is using this pragma superior to include guards? Should it be done in addition to?
I'll definitely look into that
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
Compiles, even with precompiled headers, take a bit.
Make sure that you effectively use precompiled headers: i.e. as much as possible files start with a maximum number of common lines of source code. For example, if one file includes:
#include <string>
#include <map>
and another one includes:
#include <map>
#include <string>
the precompiled headers are useless for those two files.
Serge
|
|
|
|
|
OK after ~14 hours of trying to understand why I am getting
HEAP: Free Heap block e0d998 modified at e0dc60 after it was freed
errors I am about ready to simply throttle someone and I think my wife is getting tired of me walking around cursing fluently under my breath.
Any suggestions for the best way to track them down? It only occurs when I run the programm in the debugger. If I just run it normally no error is flagged. I don't suppose I can just ignore it? (If i build in release mode I get no errors runnning the program).
Any thoughts on this would be most welcome!
The main thing I changed was moving the scope of a number of destructors in my classes from being public to protected.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
Here are a few suggestions.
1. Run the app a few times to see if the memory address at which the error occurs remains same
2. If it reamins same problem is half solved. Set a data breakpoint that if the value at the particular memory location gets modifies you break into the debugger. This will help you see any illegal calls.
Somewhere in the world there is a machine language programmer waiting for that damned assembly language fad to pass. - Stan Shanon
|
|
|
|
|
OK Cool! I'll try that later on this evening - I'm gonna take a break from it for a bit and work on something else.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
hi , what is the fastest text drawing api?
im currently using "DrawText" because i want to use clipping and alignment.
when i profile my code , i can see that DrawText uses lots and lots of cpu
if i instead switch to "TextOut" , i get way way better performance , but i lose the alignment and clipping etc.
any other api that i might use that would be faster and still allow me to align/wordwrap/clip the text?
//Roger
|
|
|
|
|
Hi all
What happens when I use SendMessage for specific window from another thread?
I've debugged this situation and found out that I reach the window's procedure, wich executed by the main thread (and not by the thread that called SendMessage) but not via message loop... ???
|
|
|
|
|
|
Hi All,
I am writing an outlook style program and I want to be able to put CView derived classes in dll's to keep them seperate from the main application, problem is though that I also want to keep all data in the CDocument derived class which is in my EXE. Unfortunately it seems that the only things that can be accessed from the DLL's are the CDocument methods and not those in my own custom CDocument derived class. If I type cast ie. (MyDoc*)CDocument(), I get the unresolved symbol linker error, which leads me to believe I will have to put all of my data classes in each dll and compile them in there too. Is there anyway to avoid having to do this as it seems like more work than just keeping all of the CView derived classes in the main EXE, even though it seems messier.
Cheers,
Clint
|
|
|
|
|
Hi,
I'm using MoveFileEx with MOVEFILE_DELAY_UNTIL_REBOOT to delete some temporary files if the user reboots the PC whilst using my program (XP/2000/NT - I'm using WinInit.INI for other systems). However, if the program closes normally, I need to cancel the MOVEFILE_DELAY_UNTIL_REBOOT for all the temporary files that it has been set for.
According to MSDN, MoveFileEx "stores the locations of the files to be renamed at restart in the following registry value:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations
This registry value is of type REG_MULTI_SZ. Each rename operation stores the following pair of NULL-terminated strings:
szDstFile\0\0
szSrcFile\0szDstFile\0\0"
I checked the registry using regedit, and found all the values there as specified, and discovered that, say if the file to be deleted is "c:\\test\test.exe", then it would be listed in the registry as:
\??\c:\\test\test.exe
Thus, to cancel all of registry entries, I tried this:
[code]
HKEY hKey;
char szRegKey[MAX_PATH];
RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\PendingFileRenameOperations",
0,KEY_ALL_ACCESS,&hKey);
//this part should be looped for each file to be deleted:
strcpy(szRegKey,"\\??\\");
strcat(szRegKey,szFileToDelete);
RegDeleteValue(hKey,szRegKey);
RegCloseKey(hKey);
[/code]
However, this didn't work - all the entries in the registry were left just as they were.
Could anybody tell me where I am going wrong, and how to correct this so that I can delete all of the registry values that were added by MoveFileEx?
Any help much appreciated,
Many thanks,
KB
|
|
|
|
|
Can anybody help?
I discovered that my problem was that the strings I was trying to delete individually weren't the registry values, but "PendingFileRenameOperations" was the value - which I was treating as a key.
Thus, I can use this code successfully to remove "PendingFileRenameOperations", the value created by MoveFileEx:
[code]
HKEY hKey;
char szRegKey[MAX_PATH];
RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Control\\Session Manager",
0,KEY_ALL_ACCESS,&hKey);
RegDeleteValue(hKey,"PendingFileRenameOperations");
RegCloseKey(hKey);
[/code]
The problem with this, of course, is that if any other programs have used MoveFileEx with MOVEFILE_DELAY_UNTIL_REBOOT, then my program will delete all this info too, which is undesirable.
Does anyone know how I can delete *only* the strings that my program has added to the PendingFileRenameOperations value?
Or, is there a function that will allow me to back up the original "PendingFileRenameOperations" value when my program starts (eg. by copying it with a different name), then add the values I need, then if my program ends normally I can replace the updated "PendingFileRenameOperations" with the backup (so that in effect the values I have added are deleted)?
Many thanks for any help,
KB
|
|
|
|
|
Ah, figured it out. I just use RegQueryValueEx to get the value of PendingFileRenameOperations when the program starts. If it returns ERROR_SUCCESS, I just replace the changed value with the saved value when the program ends using RegSetValueEx, otherwise I delete PendingFileRenameOperations using RegDeleteValue().
Thanks anyway,
KB
|
|
|
|
|
hi...
Usually the list ctrl's entire client rect is white by default.
If i want to have a different bk color when it gets the focus and also when it looses the focus.
Any help is appreciated.
Thanx
saleem
|
|
|
|
|
One solution is to derive a class from CListCtrl and do custom drawing.
Kuphryn
|
|
|
|
|
|
Michael Dunn wrote:
Ericahist updated Aug 30!
Does she know she has a stalker by the way?
--
Frivolous Theorem of Arithmetic: Almost all natural numbers are very, very, very large.
|
|
|
|
|
just call CListCtrl::Setbkcolor(RGB(255, 255, 255)); //the color you want
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
I have two applications and an event in one of the applications posts a message to the other application. I'm receiving the message in my second application with OnCopyData(). The message is being received but the receiving application remains in the background behind the window for the sending application.
I want to make the receiving application become the front-most and active window when it receives the message. I tried adding this code to OnCopyData():
SetForegroundWindow();<br />
SetActiveWindow();<br />
SetWindowPos(&wndNoTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
This seems to cause the receiving application's button on the Taskbar to flash but it's still visually behind the sending application's window.
What am I doing wrong here?
|
|
|
|
|
|
|
Hi!
I'm wondering what's the best way to skin my app?! I've build it with Borland's C++ Enterprise 6.
Already found a lot of ways and .classes, but everybody says something else.
For example;
http://www.codeproject.com/info/search.asp?target=skin&st=kw&qm=all
There must be a relatively easy way to do this?!
Thx 4 thinking with me.
Regards, Roland.
|
|
|
|
|
AFAIK I'm afraid not - you are on the right track with what you have found.
Skinning an application literally involves stopping windows drawing the various windows/controls and doing the drawing yourself. Many of the techniques you'll see involve taking an MFC class and modifying/overriding the code that actually draws that control - this gives you the look you want while retaining the all functionality. I particularly like the work by Davide Calabro - you can learn alot from this.
Phil
|
|
|
|
|
how to get the number of digits after the decimal point
ex :
Input : 5.1234
Expected Output : 4
i wrote this code but there are wornings..
what is wrong here ??
double input;
int x=input; // so x=the integeral part of input
int y=input-x; // so y=the fractional part
while(y>0)
{count++;
input*=10;
x=input;
y=input-x;
}
plz help me !!
elmahdy
ahmed elmahdy
|
|
|
|
|
First, this really sounds like homework. Not that such such posts are prohibited, but you may get a quicker response just reading ahead in your text book.
Anyway, two hints:
1) int s won't hold the fractional bits of a number.
2) converting a number from one type to another, when the second type is not able to correctly represent all values possible in the first, will cause compiler warnings.
Shog9
I returned and saw under the sun,
that the race is not to the swift,
nor the battle to the strong...
|
|
|
|
|
Given that 5.1234 is not going to represented exactly as such in memory (i.e., it's more than likely going to be something like 5.123999), you're going to have a hard time using your current code, assuming it even works.
elmahdy wrote:
int y=input-x; // so y=the fractional part
The problem with this is that 5.1234 - 5 = 0.1234 in memory, but only the 0 gets assigned to variable y . Make sense?
You could try converting the number to a string, but most of the conversion routines want to know how many digits to put after the decimal, which sort of defeats the purpose!
|
|
|
|