|
Thanks for the reply!
I'm sorry for not setting up the problem correctly, this is how I'm using the working set/VirtualAllock,Lock (probrably wrong):
* SetProcessWorkingSetSize(48Mb,64Mb)
* VirtualAlloc(32Mb,MEM_COMMIT,PAGE_READWRITE|PAGE_NOCACHE)
* VirtualLock -- I Can se it loading all pages into memory (due to Page Fault count)
* Iterate through all the pages
* Running some other process which it wery memory inensive
* Iterate through all the pages
I'm still getting some (not many) page faults (i cannt tell if they are soft or "hard" since I don't have the tool (might be I'm stupid anyway).
When looking in Process Viewer I can see that the ProcessWorkingSetSize is less than requesten/GetProcessWorkingSetSize tells me?
If I'm removing the SetProc... windows will increase the WorkingSetSize form me...
What Am I doing wrong?
Regards
Mario Toffia
|
|
|
|
|
<<< In the name of GOD >>>
Hi all.
I want to create variable for 2 dialogs.
For example:
void CTestDlg1::OnOK()
{
m_str = "Hadi";
}
void CTestDlg2::OnOK()
{
m_str = "Rezaie";
}
So, i create Global.h :
char *m_str;
and adding on header of TestDlg1.cpp and TestDlg2.cpp:
#include "Global.h"
extern char *m_str;
But this code won't work ...
Please help me ...
Hadi Rezaie
|
|
|
|
|
Hello all,
I have an installer program written in Delphi 5 that I want to add an extension to. The developer of the installer gave the format of all exported dll functions that you call from the installer. The help states that:
DLL extensions must contain an exported function conforming to the following function prototype:
function ( MainHandle, DialogHandle: HWnd; const pInstallDir: PChar; pSupportDir, pUser, pCompany, pSerial, pAdditional: PChar ): Word; stdcall; export;
Since I'm writing the dll in VC++ as a Win32 dll this is what my code looks like in my cpp file.
#include "stdafx.h"
extern "C" __declspec(dllexport) WORD ValidateInformation(HWND MainHandle, HWND DialogHandle,
const char *pInstallDir, char *pSupportDir, char *pUser, char *pCompany, char *pSerial, char *pAdditional)
{
::MessageBox(MainHandle, "Inside ValidateInformation()!", "Serial Number Validation",
MB_OK|MB_ICONINFORMATION);
return 1;
}
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
The stdafx.h file just has windows.h included in the header. What I have above compiles fine. When it gets called from the installer application, the messagebox displays it's message fine, but when it returns the installer crashes. The error states that the installer has performed an illegal operation and it will be shut down. Can anyone help me get this to work?
Thanks in advance.
--Tale
|
|
|
|
|
have you checked what function calling convention delphi uses?
it sounds like you might have a goofed up return address which is entirely plausible if the calling convention was wrong.
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Doesn't Delphi use __fastcall as default?
If so, VC++ uses in your case __stdcall and thats a another calling scheme.
|
|
|
|
|
Doesn't Delphi use __fastcall as default?
VC++ uses __stdcall in your case and thats a another param scheme.
|
|
|
|
|
I really need, a tutorial abou this. Can you help me ... someone !
|
|
|
|
|
There's a really excellent book called Database Programming with Visual C++ in 21 days that covers this. Best of all its online and free!
Got to www.informit.com and look under databases, ADO...
|
|
|
|
|
Great information. Thank you very, very much.
|
|
|
|
|
Ok, I've created a "full control" in atl object wizard.
Edit, radio, etc - ok, except listbox nd combo.
The subclassed listbox control window somehow becomes a little bit smaller, then dimensions i used in m_ctlZZZ.Create(...,rect,...)
why?
where to debug?
|
|
|
|
|
The dimensions you enter in Create(....) are for the control container, not the control itself. You need to increase the size of the rect in the Create(....) function to account for this. I don't know the exact amount though.
|
|
|
|
|
Don't you know, where to read about this fact? MSDN - ok, but where in MSDN
Why only ListBox has such behaviour?
|
|
|
|
|
<<< In the name of GOD >>>
Hi all.
Please explain to me about this pointer,
I read MSDN help, but i didn't understand.
Please help me ...
Hadi Rezaie
|
|
|
|
|
its a pointer to the current object that is used for all sorts of hidden and some overt things ... its kinda fundamental to the c++ language
for instance, in a dialog class you could set the window title by calling either:
SetWindowText(blah blah blah)
or
this->SetWindowText(blah blah blah)
it mostly gets passed as a hidden parameter in various calls between objects and can be used as a return value if you want to pass the address of the current object to another object
hmmmmmm ... is actually a very deep subject if you examine the full uses of it
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Good,
Now, What mean ::SetWindowText ???
Hadi Rezaie
|
|
|
|
|
you're kidding right?
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
It means calling the global function SetWindowText() instead of a member function of the current class.
|
|
|
|
|
This is really a basic question that any C++ book would cover in the first or second chapter.
While I have no problem helping people learn, I think that you should at least meet me halfway and have at least read some basic material covering C++.
Any decent book can do a much better job of teaching you the basics than we can in a few sentances on a board.
|
|
|
|
|
<<< In the name of GOD >>>
Hi,
I want to use Status Bar in my Dialog.
So, please write all code by CStatusBar class
for use StatusBar in dialog.
Thanks.
Hadi Rezaie
|
|
|
|
|
Have a look at
http://codeguru.earthweb.com/dialog/toolbars.shtml
Happy programming!!
|
|
|
|
|
Thanks for reply.
That is useful reply.
I have other question,
Now i want to indicate status about NUM, CAPS, ...
Please help me ...
Hadi Rezaie
|
|
|
|
|
Ok here goes.
1. Add to dialog header
CStatusBar m_wndStatusBar;
2. Define indicators array as you would in MainFrame of and SDI or MDI application
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_NUM,
ID_INDICATOR_CAPS,
};
3. Create the status bar in InitDialog
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
4. Add OnKickIdle function and Message Map entry
Message Map
ON_MESSAGE_VOID(WM_KICKIDLE, OnKickIdle)
Header
afx_msg void OnKickIdle();
Function
void CMyDlg::OnKickIdle()
{
m_wndStatusBar.OnUpdateCmdUI(reinterpret_cast<cframewnd*>(this), FALSE); // must cast
}
5. And finally the Handler entries
Message Map
ON_UPDATE_COMMAND_UI(ID_INDICATOR_CAPS, OnUpdateKeyIndicator)
Header
afx_msg void OnUpdateKeyIndicator(CCmdUI* pCmdUI);
Function
void CLittleBlackBookDlg::OnUpdateKeyIndicator(CCmdUI* pCmdUI)
{
UINT nVK;
UINT flag = 0x0001;
switch (pCmdUI->m_nID)
{
case ID_INDICATOR_CAPS:
nVK = VK_CAPITAL;
break;
case ID_INDICATOR_NUM:
nVK = VK_NUMLOCK;
break;
default:
TRACE1("Warning: OnUpdateKeyIndicator - unknown indicator 0x%04X.\n",
pCmdUI->m_nID);
pCmdUI->ContinueRouting();
return; // not for us
}
pCmdUI->Enable(::GetKeyState(nVK) & flag);
// enable static text based on toggled key state
ASSERT(pCmdUI->m_bEnableChanged);
}
Similarly if you want a toolar.
Happy programming!!
|
|
|
|
|
Ohhh, Yes.
Thanks a looooooooot.
Hadi Rezaie
|
|
|
|
|
if its a non-resizable dialog box why dont you just plonk some statc controls along the bottom and fake the status bar?
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
i have most of my projects on my main development machine but occasionally transfer them to my laptop to work elsewhere or as a temp backup ... if i load a project on my laptop under the exact same version of vc++ (ent ed 6 sp4) it takes literally 20 minutes to process the files in the project explorer view ... on my main machine it takes a few seconds
both machines are p2 350's with 128Mb ram ... anybody have a clue why this is?
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|