|
In release build my exe is crashing while invoking a dialog, its crashing in ::CreateDialogIndirect() function.
Can anybody help me.
I got two Extention dlls, one DllOne.dll and another DllTwo.dll. I am handling menu clicks into DllOne.dll's mainfrm.cpp. into a function called Fun1(). In Fun1() i am trying to invoke a dialog from DllTwo.dll. There are two Dialogs into DllTwo.dll, For first Dialog its working fine in Release Build but the second one is not working (crashing into CreateDialogIndirect()). Both of these dialogs are working perfect in Deug build. Please Help
Thanks
|
|
|
|
|
supply us with some more info or just debug it (put a break point on it)
- Roman -
|
|
|
|
|
I got one extension dll, with its own resources. It is having two dialog into its resource. i am invoing these two dialogs on menu click. I handled it in mainfrm.cpp. Its not at all giving any problem to first dialog invocation but it is crashing in second dialog invocation.
|
|
|
|
|
|
tried AFX_MANAGE_STATE also.. Not Working
I got two Extention dlls, one DllOne.dll and another DllTwo.dll. I am handling menu clicks into DllOne.dll's mainfrm.cpp. into a function called Fun1(). In Fun1() i am trying to invoke a dialog from DllTwo.dll. There are two Dialogs into DllTwo.dll, For first Dialog its working fine in Release Build but the second one is not working (crashing into CreateDialogIndirect()). Both of these dialogs are working perfect in Deug build. Please Help
|
|
|
|
|
|
Try using AFX_MANAGE_STATE(AfxGetStaticModuleState()); at the beginning of the dll function in which you are aceessing the dialog.
|
|
|
|
|
Hi all,
I am accessing remote database by using ADO RDS. I am accessing Oracle database. I am getting an error message Object/Module not found. Pl can anyone help me where i am getting the problem. I am enclosing the source code of the prg. Its was the sample prg given in MSDN. I have modified according to my requirements i.e modified the server name,dsn,username.
Its there any other alternative to access remote database other than ADO RTS.
I am getting the exception in this statement.
/*****************
hr = _com_dispatch_method(pDF, dispids[0], DISPATCH_METHOD,VT_DISPATCH, (void*) &tempPtr, L"\x0008x0008\x0003",(BSTR) bstrConnect, (BSTR)bstrSQL, 0L);
**********************/
Pl. help me. Its very urgent.
#include <stdio.h>
#include <tchar.h>
#include <objbase.h>
#import "c:\program files\common files\system\ado\msado15.dll" rename("EOF", "adoEOF") rename("BOF", "adoBOF")
#import "c:\program files\common files\system\msadc\msadco.dll"
#import "c:\program files\common files\system\msadc\msadcf.dll"
#pragma warning(disable:4786; disable:4715)
const int MAX_FIELDS = 10; // Max # of Fields
HRESULT InitDataSpace(RDS::IDataspacePtr& pDS);
HRESULT InitDataFactory(RDS::IDataspacePtr pDS, _bstr_t Server, IDispatchPtr& pIDF);
HRESULT GetDISPID( DISPID& dspid, LPOLESTR FunctionName, IDispatch * obj);
HRESULT GetSRVset(ADODB::_RecordsetPtr& pRS, _bstr_t Server, _bstr_t ConnectStr, _bstr_t SQLStr);
HRESULT FlushChanges(IDispatchPtr& pIDF, DISPID funcID, _bstr_t ConnectStr, ADODB::_RecordsetPtr pRS);
void ReadRecordset(ADODB::_RecordsetPtr pRecordset);
void AddRecord(_variant_t FieldValues[], short iFieldCount, ADODB::_RecordsetPtr pRecordset);
extern "C" int WINAPI
_tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow)
{
HRESULT hResult = CoInitialize(NULL);
ADODB::_RecordsetPtr Authors;
_bstr_t bstrServer;
_bstr_t bstrConnect;
_bstr_t bstrSQL;
_variant_t Values[4]; // Holds data for AddRec
RDS::IDataspacePtr pDS;
IDispatchPtr pIDF; // Will hold Data Factory Object
DISPID SubmitChanges; // DISPID for the function
bstrServer = "http://god";
bstrConnect = " Provider=MSDAORA;dsn=newestudy;uid=estudy;pwd=estu
dy;";
bstrSQL = "Select INSPASSWD from insapplicants";
HRESULT hrResult;
// Get the DISPID for SubmitChanges
hrResult = InitDataSpace(pDS);
hrResult = InitDataFactory(pDS, bstrServer, pIDF);
LPOLESTR FName = {OLESTR("SubmitChanges")};
hrResult = GetDISPID( SubmitChanges, FName, pIDF);
// Get the Recordset
hrResult = GetSRVset( Authors, bstrServer, bstrConnect, bstrSQL);
// Read the Recordset
ReadRecordset(Authors);
pIDF.Release();
pDS.Release();
Authors->Close();
Authors.Release();
CoUninitialize();
return 0;
}
void dump_com_error(_com_error &e)
{
printf(_T("Exception!\n"));
printf(_T("\a\tCode = %08lx\n"), e.Error());
printf(_T("\a\tCode meaning = %s\n"), e.ErrorMessage());
printf(_T("\a\tSource = %s\n"), (LPCTSTR) e.Source());
printf(_T("\a\tDescription = %s\n"), (LPCTSTR) e.Description());
}
HRESULT InitDataFactory(RDS::IDataspacePtr pDS, _bstr_t bstrServer, IDispatchPtr& pIDF)
{
HRESULT HR;
_variant_t Result;
try
{
Result = pDS->CreateObject(_bstr_t ("RDSSERVER.DataFactory"), bstrServer);
HR = Result.pdispVal->QueryInterface(_uuidof(IDispatch), (LPVOID *)&pIDF);
}
catch (_com_error &e)
{
MessageBox(NULL,e.ErrorMessage(),"",0);
printf(_T("Exception!\n"));
printf(_T("\a\tCode = %08lx\n"), e.Error());
printf(_T("\a\tCode meaning = %s\n"), e.ErrorMessage());
printf(_T("\a\tSource = %s\n"), (LPCTSTR) e.Source());
printf(_T("\a\tDescription = %s\n"), (LPCTSTR) e.Description());
dump_com_error(e);
}
return HR;
}
HRESULT InitDataSpace(RDS::IDataspacePtr& pDS)
{
// This function inputs a pointer, and then initializes it
HRESULT hr;
hr = pDS.CreateInstance(_uuidof(RDS:ataSpace));
return hr;
}
HRESULT GetDISPID( DISPID& dispid, LPOLESTR FunctionName, IDispatch * obj)
{
HRESULT hr;
hr = obj->GetIDsOfNames(IID_NULL, &FunctionName, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
return hr;
}
HRESULT FlushChanges(IDispatchPtr& pIDF, DISPID funcID, _bstr_t ConnectStr, ADODB::_RecordsetPtr pRS)
{
HRESULT hr;
try
{
hr = _com_dispatch_method(pIDF, funcID, DISPATCH_METHOD,
NULL, NULL, L"\x0008\x0009",
(BSTR) ConnectStr, (IDispatch *) pRS);
}
catch (_com_error &e)
{
dump_com_error(e);
}
return hr;
}
HRESULT GetSRVset(ADODB::_RecordsetPtr& pRS, _bstr_t bstrServer, _bstr_t bstrConnect, _bstr_t bstrSQL)
{
HRESULT hr;
RDS::IDataspacePtr pDS;
IDispatchPtr pDF; // Used for the DataFactory
IDispatch * tempPtr;
_variant_t Result;
try
{
hr = pDS.CreateInstance(_uuidof(RDS:ataSpace));
Result = pDS->CreateObject(_bstr_t ("RDSSERVER.DataFactory"), bstrServer);
hr = Result.pdispVal->QueryInterface(_uuidof(IDispatch), (LPVOID *) &pDF);
LPOLESTR Funky[1] = {OLESTR("Query")}; // name of the function to call
DISPID dispids[1]; // will hold the DISPID for the function
hr = pDF->GetIDsOfNames(IID_NULL, Funky, 1, LOCALE_SYSTEM_DEFAULT, dispids);
hr = _com_dispatch_method(pDF, dispids[0], DISPATCH_METHOD,
VT_DISPATCH, (void*) &tempPtr, L"\x0008\x0008\x0003",
(BSTR) bstrConnect, (BSTR)bstrSQL, 0L);
tempPtr->Release();
return hr;
}
catch (_com_error &e)
{ MessageBox(NULL,e.ErrorMessage(),"",0);
dump_com_error(e);
}
}
void AddRecord(_variant_t FieldValues[], short iFieldCount, ADODB::_RecordsetPtr pRecordset)
{
pRecordset->AddNew();
for (short i = 0; i < iFieldCount; i++)
{
pRecordset->Fields->Item[i]->Value = FieldValues[i];
}
}
void ReadRecordset(ADODB::_RecordsetPtr pRecordset)
{
pRecordset->MoveFirst();
while (!pRecordset->adoEOF)
{
for (short i = 0; i < pRecordset->Fields->Count; i++)
{
_bstr_t bstrName = pRecordset->Fields->Item[i]->Name;
_variant_t varValue = pRecordset->Fields->Item[i]->Value;
LPCTSTR lpszName = (LPCTSTR) bstrName;
_bstr_t bstrValue(varValue);
LPCTSTR lpszValue = (LPCTSTR) bstrValue;
if(i==0)
_tprintf(_T("\n"));
_tprintf(_T("%s: %s\n"), lpszName, lpszValue);
}
pRecordset->MoveNext();
}
}
Regards,
Praveena
Smile a while to keep your sorrow a mile
|
|
|
|
|
Hello,
I have never given any beautiful look to my apps. since they are used to move machines and to control their movements.
Now that I have some time I would do it, but I don't know if I can use icons from the Microsoft library "SHELL32.dll" and so others...
Is it legal to use them?
best regards.
|
|
|
|
|
I have a windows gdi region (or even a gdi+ region) and I am trying to determine an intersection point on its edge from a line constructed between the region's centre and another point outside of the region. Is this possible?
I know there are functions to determine whether or not a point lies within a region or not, but this only leaves me with the brute force method. I could iterate pixel by pixel from the outlying point up to the region's centre point until ::PtInRegion() changes from returning true to returning false. But this seems rather innefficient.
Please help!
Thankx,
swine
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
|
Thanks but that's the easy part! The hard part is to do it with any given region (this includes regions with curves and diagonal lines, etcetera)...
swine
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
Hi!
How can I show the property dialog box of any file from my program?
I know there´s a method using ShellExecuteEx() but I can´t get it to work.
/Jii
|
|
|
|
|
Try this:
SHELLEXECUTEINFO sei;
ZeroMemory(&sei,sizeof(sei));
sei.cbSize = sizeof(sei);
sei.hwnd = m_hWnd;
sei.nShow = SW_SHOW;
sei.lpFile = sFilename;
sei.lpVerb = _T("properties");
sei.fMask = SEE_MASK_INVOKEIDLIST;
ShellExecuteEx(&sei);
As my daughter would say, "... Whatever!"
|
|
|
|
|
Thanks, it worked just fine!
Is there a way to set which tab of the property dialog box that´ll be selected when launched?
/Jii
|
|
|
|
|
How do I get at the information that is entered in VS_VERSION_INFO in a VC++ app? I'm trying to get the information for my About Dialog and am having trouble getting at the information that I have entered there.
|
|
|
|
|
Haven't checked it out completely, but this might help...
http://www.codeproject.com/dll/showver.asp
swine
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
I believe GetFileVersionInfo() is what you are after
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
I am very new to programming. I have started using Visual C++ 6.0. I am not very familier yet with the terms used in programming.
I would like to put a bitmap in place of mu button using CBitmapButton.
I have looked over many different sites from MSDN to codeguru trying to find out how to do it. Either I get to the end and it doesn't work for some reason or the words being used are too advanced for me to understand.
are there any simpler instructions for using CBitmapButton, on the web?
Thank you.
|
|
|
|
|
It's in MSDN. Here is it's example followed by my example. Make sure you do as it says and either call create with BS_OWNERDRAW or edit the button in the resource workshop and check on OwnerDraw in the properties for the button.
Example
CBitmapButton myButton;
myButton.Create(NULL, WS_CHILD|WS_VISIBLE|BS_OWNERDRAW,
CRect(10,10,100,100), pParentWnd, 1);
myButton.LoadBitmaps(IDB_UP, IDB_DOWN, IDB_FOCUS, IDB_DISABLE);
I put this in the header file.
CBitmapButton btnStop;
CBitmapButton btnMonitor;
Then in the .cpp's OnCreate() function....
if (!m_wndToolBar.btnStop.LoadBitmaps(_T("StopUp"), _T("StopDown"), _T("StopFocus"), _T("StopDown")) ||
!m_wndToolBar.btnMonitor.LoadBitmaps(IDB_MONUP, IDB_MONDOWN, IDB_MONFOCUS, IDB_MONDOWN) )
{
TRACE0("Failed to load bitmaps for buttons\n");
AfxThrowResourceException();
}
|
|
|
|
|
If you want only to get a bitmap into the button CBitmapButton is Ok, but if you want more functionality (flat buttons, changing images depending on the mouse cursor...) without effort take a look at Davide Calabro's CButtonST, it's easy to use and will give you the possibility to use buttons as if you where programming in Delphi or VB (setting properties)...
NOTE1:
I'm novice too and it works fine for me...
NOTE2:
I'm new speaking english too...
NOTE3:
you can find CButtonSt and some other classes at codeproject in the button control related web page.
Best regards..
|
|
|
|
|
Hey all. I have run into a problem with the MessageBox command. I need the MessageBox to close as soon as a keyboard event occurs, but have yet to find an efficient way to do it. My project is a multiple document MFC program done under Visual C++ 6. Any help you can give would be cool.
|
|
|
|
|
Replace MessageBox with modal MFC dialog and override PreTranslateMessage.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
I had done something similar to this earlier and it kind of worked but it continued executing the current function even with the modal dialog open. Before I try this method, I was wondering if this would do the same?
|
|
|
|
|
Anonymous wrote:
it continued executing the current function even with the modal dialog open
Sounds strange. Did you use multiple threads?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|