|
Had a type that should be SystemParametersInfo
|
|
|
|
|
How do you get the value of an unnamed key value? In regedit it is diaplayed as "(Default)". I've tried
RegQueryValueEx(hKey,
"(default)", 0, &type,
(unsigned char*)buf, &bufsize)
but it returns 2. I've also tried to RegEnumKey() and it gets the key name ok, but it just refuses to get the value.
|
|
|
|
|
just set lpSubKey to NULL:
RegQueryValueEx(hKey,
NULL, 0, &type,
(unsigned char*)buf, &bufsize)
|
|
|
|
|
Could someone please explain what exactly shows the printing progress (status) bar, and how it is updated? I currently am using the following code, which does not have this progress bar..
void CDisplayPrintTemplate::BatchPrintPage()
{
DOCINFO di;
CPrintInfo printInfo;
CSCTaxDoc* pDoc = (CSCTaxDoc*)GetDocument();
CDC dc;
CRect draw_area;
ASSERT_VALID(pDoc);
CPrintDialog dlg(FALSE);
if (dlg.DoModal() == IDCANCEL)
return;
dc.Attach(dlg.GetPrinterDC());
dc.m_bPrinting = TRUE;
printInfo.m_bDirect = TRUE;
printInfo.m_rectDraw.left = 0;
printInfo.m_rectDraw.right = dc.GetDeviceCaps(HORZRES);
printInfo.m_rectDraw.top = 0;
printInfo.m_rectDraw.bottom = dc.GetDeviceCaps(VERTRES);
dc.DPtoLP(&printInfo.m_rectDraw);
draw_area = printInfo.m_rectDraw;
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = pDoc->GetPathName();
di.lpszOutput = NULL;
dc.StartDoc(&di);
OnPreparePrinting(&printInfo);
OnBeginPrinting(&dc, &printInfo);
for (printInfo.m_nCurPage = 1 ; printInfo.m_nCurPage <= printInfo.GetMaxPage() ; printInfo.m_nCurPage++)
{
OnPrepareDC(&dc, &printInfo);
dc.StartPage();
OnPrepareDC(&dc, &printInfo);
OnPrint(&dc, &printInfo);
dc.EndPage();
printInfo.m_rectDraw = draw_area;
}
OnEndPrinting(&dc, &printInfo);
dc.EndDoc();
VERIFY(dc.DeleteDC());
dc.Detach();
}
thanks for the help!
-dz
|
|
|
|
|
I have a very small application which should be using very little memory but according to the Task Manager the memory usage increases over time. Now of course this is a memory leak so I changed all the stack buffers to heap ones and made sure to free them at the end of each function so I know that the memory is being freed.
I also use a whole bunch of MessageBox's and a couple of GetDlgItem's.
Now figuring I'm an idiot I decided to take all of my buffer variables and instead of allocating them on the heap I decided to do so on the stack (aka not call malloc and use char[x] instead).
Again the memory usage still rises (by about 4KB mind you [if the task manager can be believed... most of my memory allocation is of the single MAX_PATH and _MAX_FNAME chunks).
Now thinking it could be from pass by value allocation I made sure and passed all my buffers by reference and yet it still rises.
(eg MessageBox(MainWindow,(char*)&buffer,"cannot open item",0);)
My last shot in the dark is maybe MessageBox is creating the leak by when clicking OK the message box is not freed by Windows or something. I know that's a stretch but I can't think of anything else.
Are there any tools out there that I can use to determine where memory is being allocated and find possible leaks? (mind you I'm using char*'s and straight Win32SDK (aka no mfc)). Can anyone suggest what I can look for next?
This is driving me absolutely batty.
Sean
|
|
|
|
|
grab a 14 day trial of Purify . it will spot most leaks in your app.
-c
Being just contaminates the void. --Robyn Hitchcock
|
|
|
|
|
Well I did that and it stated I had no leaks in the application.
Maybe I'm just trusting the Task Manager when I shouldn't be.
Sean
|
|
|
|
|
if you're on NT/2K/XP, you can try calling _heapmin somewhere in your app. sometimes that will force the OS to minimize your app's heap (really free'ing memory you think you've already free'd, but which the OS hasn't given back to the general pool). sometimes it has no effect at all...
-c
Being just contaminates the void. --Robyn Hitchcock
|
|
|
|
|
Anyone here knows of a site that has the details of how to convert
wstring to strings and vice versa in STL. Apparently, there are a
couple of different ways of doing this. I am not sure if VC6 supports
them, but anyhow, i would appreciate any hints.
thanks
|
|
|
|
|
|
I'm writing a data server. In which, I have a Server, which has methods: FirstPage, PrevoiusPage, NextPage, LastPage, Insert, Delete. One page is 20 rows set in the server.
In the client, I have a client rowset class, which will cache all the rows it fetched so far. Say, invoke server's FirstPage to get 1st 20 rows, call Nextpage to get the NextPage, and so on. All the rows got will put in internal cache in client rowset, and navigation (first, prev, next, last) are so far so good. However, when i do insert in 10th row in client side, i created an instance, and invoke server side's Insert too. However, I'm not sure WHICH PLACE the ROW WILL be. Therefore, I can't synchronize the rowset. Can anyone tell me if there's any standard for insert positioning, and how to synchronize it ?
I've to finish it pretty soon, or i'll be fired. Please help me.
|
|
|
|
|
Is there any way to rename a regsitry key that already exists? The same way a user can do when he presses F2 while in the Registry Editor?
I could not find any Win32 API function that does this, nor an automation interface of regedit...
/=/=/=/=
Deus
/=/=/=/=
|
|
|
|
|
There is no such way. Regedit at first creates new key, copies all subkeys, and then deletes old key.
|
|
|
|
|
I find it hard to believe since it is done instantaneously - even if the renamed key contains a full hierarchy. Try it yourself: create some huge subtree and then rename its root key. You'll see that it happens immediately.
/=/=/=/=
Deus
/=/=/=/=
|
|
|
|
|
When I do that my program works very fast too )) ..And why you suppose it works slowly? Most of Registry is cached in memory therefore it's just memory copying.
But if you don't believe me, run Regmon and see for yourself
|
|
|
|
|
Hi all,
Has anybody had any problems using the SGI STL with VC6?
bibamus, edamus, cras moriemur [eat, drink, for tomorrow we die]
|
|
|
|
|
How do I creata an add-in for Visual Studio .NET in C++.
I mean I create a project(Other Projects/Extensibility Projects/Visual Studio .NET Add-in) and when I try to compile it, it says:
e:\trash\MyAddin1\stdafx.h(45) : error C3506: there is no typelib registered for LIBID '{AC0714F2-3D04-11D1-AE7D-00A0C90F26F4}'
e:\trash\MyAddin1\stdafx.h(45) : fatal error C1104: fatal error importing libid: 'AC0714F2-3D04-11D1-AE7D-00A0C90F26F4'
Can anyone help me ?
|
|
|
|
|
I want to use XML to transport some data across HTTP protocol. When text in some element contains US ASCI characters then all is OK. But when some language- specific characters appear i get error.
I want to encode contents of some elements (these that contain these unfortunate characters) to BASE.64.
when I do the following, I get error.
_variant_t var_val=GetSomeText_WithStrangeChars()
..check errorcodes...
pNewNodeOut->put_dataType(L"bin.base64");
..check errorcodes... //ok it works so far
pNewNodeOut->put_nodeTypedValue(var_val); //HERE CRASH
//It is here where HRESULT is E_FAIL
The first question is: What to do to avoid error, and
to sucessfully put value of _variant_t (containing BSTR)
into element whose type is set to bin.base64 ?
The last question is:
Shall I be able to automatically get the value of the
element without explicit converting it from BASE.64 ?
I mean : Shall MSXML parser do the conversion automatically for me when I will call nodeTypedValue property ?
Thanks
Michal Januszczyk
|
|
|
|
|
I'm sorry for the generalization, but I need help using the ShellExecute() function (to launch a .hlp file).
ShellExecute(
?,
"open",
"Helpfile.hlp",
NULL,
?, //dir
SW_SHOW
);
I put a '?' where I don't know what I should put
The first is the window handle thingy, I really don't want the opened file attached to anything, how do i do this?
The second ? is the directory... I have no idea what to set this too. If it's the programs current dir, how do i find that?
Thanks
|
|
|
|
|
Set NULL.
To know current dir - invoke GetModuleFileName()
|
|
|
|
|
briefcase wrote:
The first is the window handle thingy, I really don't want the opened file attached to anything, how do i do this?
Simply put NULL there!
It works just fine!
briefcase wrote:
The second ? is the directory... I have no idea what to set this too. If it's the programs current dir, how do i find that?
Simply put NULL there too!
Those aren't necessary when you do such a thing that you do!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
hmm... alright, what am i doing wrong?
ShellExecute(
NULL,
"open",
"myhelp.hlp",
NULL,
NULL, //dir
SW_SHOW
);
myhelp.hlp exists in the same dir as the calling program.
|
|
|
|
|
that's right code. And what is happend then?
(Note that lpVerb can be setted to NULL too )
|
|
|
|
|
HWND(0) for the first argument - then any windows are parented by the desktop
NULL is usually fine for the directory parameter - it's the 'default directory' (i.e. if you were at the command prompt, it's what would be listed if you did 'dir .'), which is usually not needed if you've specified an absolute path (i.e. drive:\path...\filename.extension or \\server\path...\filename.extension for the file parameter). To get the current directory (if you need to), use the GetCurrentDirectory Win32 function.
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
How to get rid of ghost windows in XP? Thx
mIchAel Liu
|
|
|
|