|
palakurthi satish wrote:
How to assigh char to char*?
svr1 = &svr; As others have suggested, you could allocate memory for svr1 , but for only one character, that is very inefficient/wasteful. What exactly are you trying to accomplish?
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Hello,
I am using managed code to call a function in an unmanaged DLL. When I call the function, the program runs until the end of the function, and then gives a "Debug Assertion Failed!" dialog box for "Expression: _CrtIsValidHeapPoint(pUserData)". The error occurs no matter what code I have inside the function. For example, removing all the code in the dll function, so that it's just an empty function, does not prevent the error. The only thing that I've done to prevent the error is to comment out the line that calls the dll function.
This is how I import the function:
[DllImportAttribute("lib.dll")] extern "C" int func(string inputFileName);
This is the function declaration in the DLL code:
__declspec(dllexport) int func(string inputFileName)
Does anyone have any suggestions for how to track this down?
Thanks,
--Jordan
-- modified at 13:10 Friday 20th January, 2006
|
|
|
|
|
|
Even if I remove the whole function body, I get the same error. So, right now it looks like this:
__declspec(dllexport) int func(string inputFileName)<br />
{<br />
}
-- modified at 13:10 Friday 20th January, 2006
|
|
|
|
|
so, you're exporting a function that takes a std::string as input ? i suspect then that the std string ctor is going to be called even if there isn't any code in the body of the function. that could be related to the problem.
what if you change that to:
__declspec(dllexport) int func(const char *inputFileName)
{
}
?
Cleek | Image Toolkits | Thumbnail maker
-- modified at 13:15 Friday 20th January, 2006
|
|
|
|
|
Yes! That fixed it. Thanks.
So it's not allowed to create a managed function that uses an unmanaged class as input?
--Jordan
|
|
|
|
|
Jordan C. Atlas wrote: So it's not allowed to create a managed function that uses an unmanaged class as input?
i wish i could answer that... but i really don't know.
glad my suggestion helped, though.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Hi,
Is there a way in the code to ignore a library at linkage if the corresponding dll is not on the system or registered?
Thanks,
Tony
|
|
|
|
|
Use explicit linking instead.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Are you having a problem while linking?
AFAIK, the linker will not complain about the missing lib unless it could not resolve any symbol while linking.
-Prakash
|
|
|
|
|
Hi
In my application i have a wizard which has two dlg boxes derived from CPropertyPage & added to CPropertySheet class.
Now when the user makes his choice and and presses the <finish> button, a long process is called. Now untill the entire process ends, the wizard is not terminated.
I want the Wizard to terminate before the start of the lengthy process.
How do i achieve this?Plz suggest.
I am showing the code inside the OnWizardFinish() function.
BOOL CSelectSearchDriveDlg::OnWizardFinish()
{
CStxApp *pApp = (CStxApp*)AfxGetApp();
CMainFrame* pFrame = (CMainFrame*)GetParentFrame();
int nRet = 5; // Any value will do.
//Destroy wizard dialog
pApp->m_pMySheet->EndDialog(IDCANCEL);
pApp->m_pMySheet->PressButton(PSBTN_CANCEL);
//DoEvents();
//DestroyWindow();
pApp->FSys->DoLengthyProcessing();
return CPropertyPage::OnWizardFinish();
}
void CSelectSearchDriveDlg::DoEvents()
{
MSG msg;
// PeekMessage retrieves messages associated with the window or any of its children.
// During this call, the system delivers pending messages that were sent to windows.
while(::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
{
if(::GetMessage(&msg, NULL, 0, 0))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
else
break;
}
}
I have tried everything such as:
pApp->m_pMySheet->EndDialog(IDCANCEL);
pApp->m_pMySheet->PressButton(PSBTN_CANCEL);
//DoEvents();
//DestroyWindow();
But with no success.
When i tried DestroyWindow() the GUI data(Buttons,list control, editbox) from the wizard disappeared but the wizard was still there.
How can i make sure that the wizard terminates before the lengthy process begins.
Waiting for suggestions
Best Regards
|
|
|
|
|
Maybe it is possible to move the lenghty process outside the Wizzard (I don't if this is already donc or not). And, also for me the best thing to do when you have a lenghty process is to start it in a separate thread to avoid the UI to freeze.
|
|
|
|
|
I am not sure where you are doing the processing. I believe it is in CMainFrame.
You could:
Create a custom message handler in CMainFrame, like:
//In resource.h:
#define WM_MYMESSAGE WM_APP + 200
Define a function to handle the message:
//In mainfrm.h
LRESULT OnMyMessage(WPARAM, LPARAM);
In mainfrm.cpp:
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)<br />
...<br />
...<br />
ON_MESSAGE(WM_MY_MESSAGE,OnMyMessage)<br />
END_MESSAGE_MAP()<br />
<br />
LRESULT CMainFrame::OnMyMessage(WPARAM, LPARAM)<br />
{<br />
}
Now send the message:
//In the wizard:
CMainFrame* pFrame = ...whatever.<br />
pFrame->PostMessage(WM_MYMESSAGE,0,0);
All this is from memory, so there may be bugs.
this is this.
|
|
|
|
|
dp_76 wrote: I want the Wizard to terminate before the start of the lengthy process.
Depending on how you started this "lengthy process," this may not be possible. If you used CreateProcess() , then it is simply a matter of ending the Wizard in a normal fashion. Otherwise, the Wizard will need to hang around along with the other, although it can be hidden.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Is there a windows function to get effective permissions of shared files or folders?
Do you have any suggestions on how i can go about this?
Kelvin Chikomo
|
|
|
|
|
|
Is there a video class that gives access to the pixels of each frame (MFC or not)?
|
|
|
|
|
|
Have u tried for CDC class?
one time i have requirement that do image processing on captured images from webcam(Live streaming). so i use this class.
|
|
|
|
|
Hello Friends
In my dialoged based MFC programm I need to handle and set certain registry values before windows gets shut down and also immediately after Windows loggs in(i.e immediately after user presses Ctrl+Alt+Del and enterys passwords).
I read that it sends some message WM_QUERYENDSESSION or something like that but don't know how to trap that message or how to achieve this?
Any such example or any idea please.
Thankx and regards in advance.
Mahesh
|
|
|
|
|
Amarelia wrote: but don't know how to trap that message or how to achieve this?
For the logoff:
There is a MFC OnQueryEndSession() wrapper in the class CWnd. Since your Dialog is derived from CWnd, you can do following (assuming VC6++) :
Rightclick on your Cdialog class in the class browser : Add Windows Message Handler, In the dialog that pops up change Dialog to Window in the combobox on the bottom right, and then select WM_QUERYENDSESSION in the list. Here you have your wrapper.
This implies that your app is alive when windows shutdown.
~RaGE();
|
|
|
|
|
Amarelia wrote: I need to handle and set certain registry values...immediately after Windows loggs in(i.e immediately after user presses Ctrl+Alt+Del and enterys passwords).
You can do this with your own GINA DLL, or implement the ISensLogon interface.
Amarelia wrote: I read that it sends some message WM_QUERYENDSESSION or something like that but don't know how to trap that message or how to achieve this?
I believe you'll want to look for WM_ENDSESSION instead. Windows will send the WM_QUERYENDSESSION message asking applications if it is ok to exit. If any of them respond with a zero value, no further WM_QUERYENDSESSION messages are sent. If all of the applications respond with a non-zero value, Windows will then send a WM_ENDSESSION message.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
I wouldn't write a GINA unless nessecary since it will not be portable to Windows Vista.
---------------
Windows Login
Winlogin (GINA) is being rewritten for Windows Vista to reduce number of necessary processes and components loaded. The new GINA will not be replaceable. A new Credential Provider Model will be used for extensibility. New mechanisms will also be provided to support existing functionality. A new Eventing and Stacking, and Chaining model will be provided.
http://www.activewin.com/winvista/thestateofvista.shtml[^]
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
Toby Opferman wrote: I wouldn't write a GINA unless nessecary since it will not be portable to Windows Vista.
I wouldn't either. I was just offering suggestions.
Care to offer help on this one?
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
I created one dialog and also a global function in my coding, i have to control that dialogue from this global function....
(Im doing EnableWindow function in tht Global function...)
How can i access tht dialogue from global function?
Thanx in advance
|
|
|
|