|
Pradeep.Reddy wrote: But failed to invoke Dialogs.
How you are doing this ?
|
|
|
|
|
I have one MFC application, I removed the resource(.rc file) in the "File View". I created a "Reource-Only DLL" and I added that removed resource(.rc file and resource.h file) here. With Linker option as /NOENTRY.
I have done one small test program and its working fine. But if I implement same in my application I'm getting Error code as 1407 (i.e., "Cannot find window class.") in my application workspace.
If i debug through I will get this error in "hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,pParentWnd->GetSafeHwnd(), AfxDlgProc);" and file path is "..\MFC\SRC\DLGCORE.CPP"
Please can you help me on this...
Pradeep
|
|
|
|
|
Refer localization [^] section of this site.
You will get good idea , how to acheive this.
|
|
|
|
|
Try "AFX_MANAGE_STATE(AfxGetStaticModuleState());" before you call the dialog in the dll
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
Hi,
Even I tried with "AFX_MANAGE_STATE(AfxGetStaticModuleState());".
I have done one small test program and its working fine. But if I implement same in my application I'm getting Error code as 1407 (i.e., "Cannot find window class.") in my application workspace.
If i debug through I will get this error in "hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,pParentWnd->GetSafeHwnd(), AfxDlgProc);" and file path is "..\MFC\SRC\DLGCORE.CPP"
Please can you help me on this...
Pradeep
|
|
|
|
|
If is a MFC dll, make the project MFC extension dll, load the dll normally with LoadLibrary or AfxLoadLibrary, and use it directly.
For example, you may have a dialog implemented in DlgCustom.cpp/.h in DlgCustom.dll but resource is actually in DlgCustomRC.dll.
A possible implementation can be
#include "../DlgCustomRC/resource.h"
class CDlgCustom
{
enum IDD = { IDD_CUSTOM };
protected:
HMODULE m_hRC;
};
CDlgCustom::CDlgCustom()
{
m_hRC = LoadLibrary(_T("DlgCustomRC.dll"));
}
CDlgCustom::~CDlgCustom()
{
FreeLibrary(m_hRC);
}
and instantiation can simply be
void CParentWindow::onCallCustom()
{
CDlgCustom dlg(this);
dlg.DoModal();
}
The DlgCustom.dll will export the class CDlgCustom, that will manage itself the loading of resource-only dll DlgCustomRC.dll.
VERY important is to have resources in all those binaries that do not overlap.
So NO two dialogs with the same ID in the same executable space. I had to write tools that detects and reports such "resource clash" conditions.
If you want to do the job manually, load the library with "load library as data file" since is a resource dll, locate the resource with RT_DIALOG and corresponding IDD, create the DLGTEMPLATE and then use a CreateDialogXXX call. MFC does this - consult the implementation of CreateDialog (I think is in ../mfc/src/dlgcore.cpp).
|
|
|
|
|
Hi,
I have done one small test program and its working fine. But if I implement same in my application I'm getting Error code as 1407 (i.e., "Cannot find window class.") in my application workspace.
If i debug through I will get this error in "hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,pParentWnd->GetSafeHwnd(), AfxDlgProc);" and file path is "..\MFC\SRC\DLGCORE.CPP"
Please can you help me on this...
Pradeep
|
|
|
|
|
It could be a custom control or ActiveX control that is not registered, and contained in the dialog. Other than that, I have no idea, and I can't help you since I cannot debug your code. Check again the usual problems (resources, dll paths, initialization problems etc.), it shouldn't be something that cannot be found on a careful analysis.
|
|
|
|
|
When i open a project provided by the manufacturer of an ip camera i get the following messages.
"The Active X control cannot be instantiated".
" 2 Active X controls could not be instantiated".
"Reinstall or Register the controls and try again".
How can i resolve this problem?
|
|
|
|
|
As error says, your project contains some activeX , which needs registration.
Try registering those.
|
|
|
|
|
|
You need to identify activeX in your project and use following line from commandline
regsvr32 /u "activeXFile"
RegSvr32[^]
|
|
|
|
|
Hi experts,
I want to add a com dll file in my project.I wtitten the below code to create a pst file in c drive.
Program compiled successfully
But the function Logon() goes fail and sows a exception :
"Unhandled exception at 0x7c812a5b in samp.exe: 0x0EEDFADE: 0xeedfade."
CoInitialize(NULL);
IRDOSessionPtr session;
HRESULT hr = session.CreateInstance(__uuidof(RDOSession));
session->Logon(" ",NULL,NULL,NULL,NULL,NULL);
session.Release();
what is the problem.Is there other way to add com dll in prject.
Plz tell
manu
|
|
|
|
|
You should always check the returned HRESULT value, i.e.
if (FAILED(hr)))
{
}
and never use the pointer (even the smart ones ) if the
CreateInstance failed.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Whats return value of hr?
|
|
|
|
|
Again this is malini.I dont know how to start. Suppose i am connected to net. And http://WebSite/ResourceName?Data=Data....... is the address. Can i find the address using C++. Does there exists any class for this?
Thanx in advance friends!!
Malini
|
|
|
|
|
Malini Nair wrote: Suppose i am connected to net. And http://WebSite/ResourceName?Data=Data....... is the address.
You can be connected to more than one site at a time. IE has an automation interface that you can use to enumerate the currently open URLs.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Hello, I am writing an outlook DLL, it is for a phone system and when a call is received I search through the outlook contacts (using called ID) find the person and open the contact in a window.
My problem is that this locks up outlook. When I open the contact under a button, e.g.
void __stdcall CAddin::OnClickButton2(IDispatch* Ctrl,VARIANT_BOOL * CancelDefault)
{
USES_CONVERSION;
CComQIPtr<office::_commandbarbutton> pCommandBarButton(Ctrl);
static Outlook::_InspectorsPtr inspectorsPtr;
static Outlook::_InspectorPtr inspectorPtr;
Outlook::MAPIFolderPtr pFolder = m_spApp->GetNamespace("MAPI")->GetDefaultFolder(olFolderContacts);
Outlook::_ItemsPtr pItems = pFolder->Items;
Outlook::_ContactItemPtr pContact = pItems->GetFirst();
inspectorsPtr= m_spApp->GetInspectors();
inspectorPtr = inspectorsPtr->Add(pContact);
inspectorPtr->Display(vtMissing);
}
This works fine, when I put the same code in my dll, e.g.
static void openContactOnCall(char* number)
{
static Outlook::_InspectorsPtr inspectorsPtr;
static Outlook::_InspectorPtr inspectorPtr;
Outlook::_ContactItemPtr contact = findContact(number);
if (contact)
{
// Contact is valid
inspectorsPtr= m_spApp->GetInspectors();
inspectorPtr = inspectorsPtr->Add(contact);
inspectorPtr->Display(vtMissing);
}
else
Debug("Didn't find contact");
}
A window opens with the contact but outlook then freezes. The contact must be valid as I see the correct name in the windows title bar. I have triggered outlook as it does open the window.
I've hacked around with this for sometime, and haven't got anywhere. I am clearly missing something quite fundamental but the fact the same code works under a button but not in the dll has got me confused, and shows that I do not understand something fundamental to how this should be working. Any help would be greatly appreciated.
Gavin.
|
|
|
|
|
Hi all,
I am partly through creating a console application that runs a Windows app. All this I have managed to perform, but the following I am unsure of.
I now need to bring the form to the current view (which I have achieved), then put the mouse pointer in a certain position then simulate pressing the left mouse button.
Can anyone suggest where I need to start looking to allow me to work this one out ?
Pete
|
|
|
|
|
Fritzables wrote: then put the mouse pointer in a certain position then simulate pressing the left mouse button.
Is mouse_event() of any help here?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
G'Day Dave,
That sounds the GO, but what about getting the Mouse Cursor in the position I want ?
Pete
|
|
|
|
|
i guess the right way would be the SendMessage function. use it with the parameter WM_LBUTTONUP.
walter
|
|
|
|
|
Thanks Walter..... have a look at the reply I shot Dave.
Pete
|
|
|
|
|
I am not sure about a console application.
In Windows the mouse pointer is called a ‘cursor’ and you can set the position by calling SetCursorPos(x,y). Note that if ClipCursor was used to limit its rectangular area of movement then it will remain in that area.
After setting its position you can post the button-down and button-up messages, in that order, to simulate a button press & release.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|