|
Just as Chris said, you have a CString str; you can do a str.Format("%d", yourIntData);
|
|
|
|
|
Thanks for the feedback.
CString strTemp;
__int64 iValue = ULONG_MAX + ULONG_MAX;
strTemp.Format("%d", iValue);
This does not produce the correct result. It works for 32 bit numbers, but it does not appear to work for 64 bit numbers.
I have solved the problem, though.
|
|
|
|
|
Use _i64toa .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello.
Could someone please help on how I can tackle this little program using any data structure( a stack, link list or queue).
Having a computer processing one line at at time,whereby each line of input contains an ID#, a starting time,and a sequence of integers representing the duration of each job.If the jobs are in a 1st run 1st come basis.The output of the program should be a list of ID#s, a starting and finishing time for each job, and the average waiting time for each job.
Thanks.
|
|
|
|
|
I'd use a std::deque<job> , where job is a struct defined by you containing the relevant info about a job.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Any help ?
I would like to implement in my own program the Reascan disks of the Disk Administrator of Windows NT/2000/XP.
I can't find any entry in the MSDN...
Anyone knows how to do that ?
Thanks
Zindine
|
|
|
|
|
In order to use the Microsoft Web Browser ActiveX control, I need to call AfxEnableControlContainer() in my App::InitInstance. My application requires that I also call CoInitializeEx(NULL, COINIT_MULTITHREADED).
When I comment out the CoInitializeEx() call, the browser displays. If I let it run, the dialog with the ActiveX control won't initialize.
Any guesses as to what the problem is?
J
"I am wise enough to therefore not spout my ill informed opinion as if it were remotely related to fact." - Christian Graus
|
|
|
|
|
If you're using MFC I believe that you are supposed to use AfxOleInit() instead, though it's been a while so I could be wrong.
--
Andrew.
|
|
|
|
|
Ok, but AfxOleInit doesn't let me set the threading model. And I need a multithreaded environment for my callbacks. When I use it, my callbacks stall out.
Any other ideas?
J
"I am wise enough to therefore not spout my ill informed opinion as if it were remotely related to fact." - Christian Graus
|
|
|
|
|
I have a standard MFC SDI application. I need to generate some simple text reports to be printed, and I thought I could just have few routines spit out HTML into a viewer control.
Can someone recommend a method for doing this? I already have documents and views, so I don't think CHtmlView will do it for me.
Any pointers would be greatly appreciated.
J
"I am wise enough to therefore not spout my ill informed opinion as if it were remotely related to fact." - Christian Graus
|
|
|
|
|
Who knows how to deallocate memory I allocated using something like this: char *x = new char[100000000]; ? I know tha there is a 'delete' command, but it deallocates mem only for the current app and I want to give the memory back to the OS. Any ideas ?
|
|
|
|
|
Take a look at the VirtualAlloc routines.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I have made a program to make questions for a boardgame i'm making. I use structures and write them to a file with fwrite so there are often long strings of unused data stored. The strange thing is that when I use the Release version of my program the long strings is just random garbage that happend to be in the memory. But when I use the Debug version the long strings are made up of the same characters (which is very very good when I compress the savefiles). Why is this happening?
|
|
|
|
|
the Debug verion of the memory allocators automatically initailize their buffers.
The Release version of memory allocators simply use the memory as it is found.
This is to allow you to find bugs in debug mode, and not slow down your release mode operation. What you may want to do if you are concerned with this is initialize all of the buffers that you use.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
the compiler often initializes memory for debug builds. it's not so nice in release builds.
-c
I don't care, and you can't make me.
|
|
|
|
|
I want to konw how to clear my view's content,anyone help me?thx.
YES, I am here.
|
|
|
|
|
What kind of view?
It could be as simple as calling SetWindowText(hWnd, ""); It could be as involved as destorying all your internal document objects and calling Invalidate(FALSE);
Unless you are using one of the MFC provided control-views (tree view, edit view, list view), you are doing all the drawing yourself in the OnDraw function. If that is the case you will have to do whatever you need to do to blank the screen.
For CEditView, just SetWindowText, for CTreeView I believe it is DeleteAllItems and for CListView I believe it is DeleteAllItems also.
Look in MSDN for more info.
|
|
|
|
|
Everytime I try to step into the VC7 source code (MFC/CRT) in the debugger, VC7 demands that I insert a CD (actually, it tells me it can't find the file, and points to a location on the f: drive, which is even more puzzling, since my CD is the D drive..., and I don't have an F:/ drive). Or sometimes it simply breaks into disassembly code, rather than showing me source. As far as I can tell, the MFC and CRT source code is present on my machine. Does anyone know why VC7 can't find it?
TIA -
|
|
|
|
|
It's very frustrating. I get the same thing when debugging. VC will come up and say that it can't find a given INL or H file. I'm like "You installed the damn files! How can you not find them?!" Typically, I simply need to point to the correct include folder, but it's stil annoying nonetheless. There's no doubt that VS.NET was rushed to market as it has numerous bugs
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
|
|
|
|
|
Hi there ...
I load a bitmap, transparently ...
Here is my source code:
[ccode]
UINT nStyle = LR_LOADFROMFILE | LR_LOADTRANSPARENT;
HBITMAP hBitmap = (HBITMAP)LoadImage(AfxGetInstanceHandle(), lpszPath, IMAGE_BITMAP, 0, 0, nStyle);
[/ccode]
But when i draw it, i can't see my transparent bitmap
[ccode]
// m_Board is my object from my own structure
// dcSource is CDC object ...
// bm is BITMAP object ...
// There isn't problem for drawing picture ...
// I just want to draw it transparently !
dc.BitBlt( 10, 10, m_Board.bm.bmWidth, m_Board.bm.bmHeight, &m_Board.dcSource, 0, 0, SRCCOPY );
[/ccode]
Help me, please
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
LR_LOADTRANSPARENT is missleading, as all it really does is change colors. From MSDN:
LR_LOADTRANSPARENT Retrieves the color value of the first pixel in the image and replaces the corresponding entry in the color table with the default window color (COLOR_WINDOW). All pixels in the image that use that entry become the default window color. This value applies only to images that have corresponding color tables.
Do not use this option if you are loading a bitmap with a color depth greater than 8bpp.
So this is probably not what you want (although it can be useful on occasion). This article may provide you with something useful though.
--------
I don't think that I'm a sell-out but I do "Enjoy Coke!"... -- Bloodhound Gang, The Inevitable Return Of The Great White Dope
|
|
|
|
|
Thanks alot for your help
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
What do you mean you cannot see the transparent bitmap? Do you mean that you cannot see your bitmap at all, or the areas that should be transparent are not.
The LR_LOADTRANSPARENT flag only works with 8-bit images and will convert the first pixel found in the image to the default color for a window. So if you are not painting your bitmap to a window that has the background color set to the default color then this technique will not work.
What you may want to do is create a monochromatic bitmap match to your bitmap, that acts as a transparency mask, then you can use MaskBlt to paint the transparent portions of your bitmap.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thanks alot for your help
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
An app which has worked fine under W2K crashes in the exception handler under XP both with the binary built under W2K or XP, using VC++6.
It happens at the END_CATCH line in the code below (generates an access
violation at 0xc0000005) if the file does not exist.
It worked fine in W2K. What is different between W2K and XP that could cause this?
BOOL CUnembedDlg::OpenFile(CString f_name)
{
TRY
{
// Open the file in text mode to do
// CR-LF -> LF converison.
CStdioFile cstdf(f_name, CFile::typeText | CFile::modeRead);
DWORD f_size = cstdf.GetLength();
LPTSTR s = file.GetBufferSetLength((int)f_size);
cstdf.Read(s, (UINT)f_size);
cstdf.Close();
file.ReleaseBuffer(-1);
m_FileSize = file.GetLength();
if (-1 == file.Find("embedded-sysfiles", 0))
{
CString err_msg = "File not recognized";
MessageBox(err_msg, f_name, MB_OK | MB_ICONERROR);
m_combo1.SendMessage(WM_SETFOCUS, 0, 0);
m_combo1.Clear();
return false;
}
return true;
}
CATCH(CFileException, e)
{
e->ReportError();
e->Delete();
m_combo1.SendMessage(WM_SETFOCUS, 0, 0);
m_combo1.Clear();
m_combo1.RemoveFromMRU(f_name);
m_combo1.RefreshCtrl();
}
END_CATCH
return false;
}
while (!asleep)
code();
|
|
|
|