|
ptr_Electron wrote: Unhandled exception at 0x006d7074 in ang.exe:0xC0000005
Access violation reading location 0xcdcdcdcd
Have you used the debugger to step through the code to find the offending statement(s)?
ptr_Electron wrote: ts->_this->Dlg->DoModal();
It's not a good idea for a secondary thread to operate directly on a UI component owned by another thread. What you have looks as though it would block the primary thread.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
the crash is @ delete dlg;
|
|
|
|
|
I've a SDI project where View class is derived from
CFormView.
I need to change the form of the View on the fly in
order to show a different form for each application
status.
Is it possible to do that ? How ?
Thanks a lot !
|
|
|
|
|
I will suggest you to reconsider your design.
Having multiple views for SDI and switching between them i don't think is advisable.
Regards,
Sandip.
|
|
|
|
|
|
|
hi all,
Whats the best way to simplyfy this function?
LRESULT CMainDlg::OnInstall(WORD , WORD wID, HWND , BOOL& )
{
DWORD BufferSize, Size, Type;
BufferSize = TOTALBYTES;
PPERF_DATA_BLOCK PerfData = (PPERF_DATA_BLOCK) malloc( BufferSize );
string LaunchInstaller;
string InstallFolder;
CAtlString StrTable;
TCHAR tcItemText[MAXBYTES];
StrTable.LoadStringA(IDS_ServiceRegEntry);
LaunchInstaller.append(StrTable.GetString());
StrTable.LoadStringA(IDS_LongProjectName);
LaunchInstaller.append(StrTable.GetString());
StrTable.LoadStringA(IDS_ServiceParam);
LaunchInstaller.append(StrTable.GetString());
LaunchInstaller.append("\\");
StrTable.LoadStringA(IDS_MANAGEKEY);
LaunchInstaller.append(StrTable.GetString());
if(UpdateList.GetItemText(Select, tcItemText, MAXBYTES))
{
LaunchInstaller.append("\\");
LaunchInstaller.append(tcItemText);
InstallFolder = tcItemText;
lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, LaunchInstaller.c_str(), REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,&Regentry);
if (lResult == ERROR_SUCCESS)
{
Size = BufferSize;
StrTable.LoadStringA(IDS_UPDATEINSTALL);
lResult = RMRegQueryValueEx(Regentry, StrTable.GetString(), NULL, &Type, reinterpret_cast<LPBYTE>(SoftwareInstaller), &Size);
Size = BufferSize;
StrTable.LoadStringA(IDS_UPDATEFILE);
RMRegQueryValueEx(Regentry, StrTable.GetString(), NULL, &Type, reinterpret_cast<LPBYTE>(SoftwarePath), &Size);
if(lResult == ERROR_SUCCESS)
{
Path = SoftwarePath;
InstallFolder = SoftwareInstaller;
if(!(Path.empty()))
{
ExecuteInstaller(Path, InstallFolder);
}
}
RegCloseKey(Regentry);
Regentry = NULL;
}
else
{
LaunchInstaller = "";
StrTable.LoadStringA(IDS_ServiceRegEntry);
LaunchInstaller.append(StrTable.GetString());
StrTable.LoadStringA(IDS_LongProjectName);
LaunchInstaller.append(StrTable.GetString());
StrTable.LoadStringA(IDS_ServiceParam);
LaunchInstaller.append(StrTable.GetString());
LaunchInstaller.append("\\");
StrTable.LoadStringA(IDS_RERITEKEY);
LaunchInstaller.append(StrTable.GetString());
LaunchInstaller.append("\\");
LaunchInstaller.append(tcItemText);
InstallFolder = tcItemText;
lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, LaunchInstaller.c_str(), REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,&Regentry);
if (lResult == ERROR_SUCCESS)
{
Size = BufferSize;
StrTable.LoadStringA(IDS_UPDATEINSTALL);
lResult = RMRegQueryValueEx(Regentry, StrTable.GetString(), NULL, &Type, reinterpret_cast<LPBYTE>(SoftwareInstaller), &Size);
Size = BufferSize;
StrTable.LoadStringA(IDS_UPDATEFILE);
RMRegQueryValueEx(Regentry, StrTable.GetString(), NULL, &Type, reinterpret_cast<LPBYTE>(SoftwarePath), &Size);
if(lResult == ERROR_SUCCESS)
{
Path = SoftwarePath;
InstallFolder = SoftwareInstaller;
if(!(Path.empty()))
{
ExecuteInstaller(Path, InstallFolder);
}
}
RegCloseKey(Regentry);
Regentry = NULL;
}
else
{
LaunchInstaller = "";
StrTable.LoadStringA(IDS_ServiceRegEntry);
LaunchInstaller.append(StrTable.GetString());
StrTable.LoadStringA(IDS_LongProjectName);
LaunchInstaller.append(StrTable.GetString());
StrTable.LoadStringA(IDS_ServiceParam);
LaunchInstaller.append(StrTable.GetString());
LaunchInstaller.append("\\");
StrTable.LoadStringA(IDS_RERITEASIANKEY);
LaunchInstaller.append(StrTable.GetString());
LaunchInstaller.append("\\");
LaunchInstaller.append(tcItemText);
InstallFolder = tcItemText;
lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, LaunchInstaller.c_str(), REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,&Regentry);
if (lResult == ERROR_SUCCESS)
{
Size = BufferSize;
StrTable.LoadStringA(IDS_UPDATEINSTALL);
lResult = RMRegQueryValueEx(Regentry, StrTable.GetString(), NULL, &Type, reinterpret_cast<LPBYTE>(SoftwareInstaller), &Size);
Size = BufferSize;
StrTable.LoadStringA(IDS_UPDATEFILE);
RMRegQueryValueEx(Regentry, StrTable.GetString(), NULL, &Type, reinterpret_cast<LPBYTE>(SoftwarePath), &Size);
if(lResult == ERROR_SUCCESS)
{
Path = SoftwarePath;
InstallFolder = SoftwareInstaller;
if(!(Path.empty()))
{
ExecuteInstaller(Path, InstallFolder);
}
}
RegCloseKey(Regentry);
Regentry = NULL;
}
else
{
LaunchInstaller = "";
StrTable.LoadStringA(IDS_ServiceRegEntry);
LaunchInstaller.append(StrTable.GetString());
StrTable.LoadStringA(IDS_LongProjectName);
LaunchInstaller.append(StrTable.GetString());
StrTable.LoadStringA(IDS_ServiceParam);
LaunchInstaller.append(StrTable.GetString());
LaunchInstaller.append("\\");
StrTable.LoadStringA(IDS_RERITECHINAKEY);
LaunchInstaller.append(StrTable.GetString());
LaunchInstaller.append("\\");
LaunchInstaller.append(tcItemText);
InstallFolder = tcItemText;
lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, LaunchInstaller.c_str(), REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,&Regentry);
if (lResult == ERROR_SUCCESS)
{
Size = BufferSize;
StrTable.LoadStringA(IDS_UPDATEINSTALL);
lResult = RMRegQueryValueEx(Regentry, StrTable.GetString(), NULL, &Type, reinterpret_cast<LPBYTE>(SoftwareInstaller), &Size);
Size = BufferSize;
StrTable.LoadStringA(IDS_UPDATEFILE);
RMRegQueryValueEx(Regentry, StrTable.GetString(), NULL, &Type, reinterpret_cast<LPBYTE>(SoftwarePath), &Size);
if(lResult == ERROR_SUCCESS)
{
Path = SoftwarePath;
InstallFolder = SoftwareInstaller;
if(!(Path.empty()))
{
ExecuteInstaller(Path, InstallFolder);
}
}
RegCloseKey(Regentry);
Regentry = NULL;
}
}
}
}
}
else
{
ATL::CString str;
str.Format ( _T("Please choose an item to install"));
MessageBox ( str, _T("Redmap Update Manager"), MB_ICONWARNING );
}
free( PerfData );
return 0;
}
Thanks,
Jayjay
|
|
|
|
|
Rewriting it from scratch?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
monsieur_jj wrote: Size = BufferSize;
StrTable.LoadStringA(IDS_UPDATEINSTALL);
lResult = RMRegQueryValueEx(Regentry, StrTable.GetString(), NULL, &Type, reinterpret_cast<lpbyte>(SoftwareInstaller), &Size);
Size = BufferSize;
StrTable.LoadStringA(IDS_UPDATEFILE);
RMRegQueryValueEx(Regentry, StrTable.GetString(), NULL, &Type, reinterpret_cast<lpbyte>(SoftwarePath), &Size);
if(lResult == ERROR_SUCCESS)
{
Path = SoftwarePath;
InstallFolder = SoftwareInstaller;
if(!(Path.empty()))
{
ExecuteInstaller(Path, InstallFolder);
}
}
RegCloseKey(Regentry);
Regentry = NULL;
You can put these bunch of statements in some function and pass the parameters appropriately instead of repeating same code everywhere.
monsieur_jj wrote: LaunchInstaller = "";
StrTable.LoadStringA(IDS_ServiceRegEntry);
LaunchInstaller.append(StrTable.GetString());
StrTable.LoadStringA(IDS_LongProjectName);
LaunchInstaller.append(StrTable.GetString());
StrTable.LoadStringA(IDS_ServiceParam);
LaunchInstaller.append(StrTable.GetString());
LaunchInstaller.append("\\");
StrTable.LoadStringA(IDS_RERITEKEY);
LaunchInstaller.append(StrTable.GetString());
LaunchInstaller.append("\\");
LaunchInstaller.append(tcItemText);
I can also see the above statements repeated you can have function for this as well.
I think that should simplify your code considerably.
I hope it helps..
Regards,
Sandip.
|
|
|
|
|
5!
How patiently you've waded through that huge pile of code.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Rajesh R Subramanian wrote: 5!
Thanks Rajesh
Regards,
Sandip.
|
|
|
|
|
If the code is OK, and you tested it, that you are sure it is with no bug,etc
then you can simplify it this way :
1-create a new function (you can put it in a separate file) and move your code there :
LRESULT doBigThings(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
or may be :
LRESULT doBigThings(CMainDlg* pDlg,WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
if the code access some members of the Dlg, something I do not want to verify by myself by looking at that source code.
2-change CMainDlg::OnInstall to :
LRESULT CMainDlg::OnInstall(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
return doBigThings(wNotifyCode,wID,hWndCtl,bHandled);
}
Thus try to forget what is inside doBigThings, just look at maindlg.cpp then conclude to yourself :
OK I have good, fucntionning and very simple simplified code, now I have to move forward.
Of course unless the given source code is not yours, and that only you would like to confirm some personal opinion when you first looked at that someon'else code, by seeing our own reaction at it.
Because that case I can show you what is worse.
Our Philosophy, Mohammed Baqir Al Sadr
|
|
|
|
|
Hi
I have installed VC++ 2003 in WinXP, my MFC projects don't work in vista SP1,
How I can solve this?
thanks
www.logicsims.ir
|
|
|
|
|
Have you installed the Visual C++ 2003 redistributable components on the target machine?
Funny how this question is asked almost every single day.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
sure, I copied them all, it's not becaouse of MFc dlls
I need an article in MSDN or codeproject about this,
www.logicsims.ir
|
|
|
|
|
Hello everyone,
When writing an ATL COM server, MIDL compiler will automatically generated file _i.c and _i.h from IDL definition.
My question is whether my below usage for the two files are correct when writing a COM client (consumer)?
1. I put _i.h file into the "Header files" of the client project, and using it to make the build for client project;
2. I put the _i.c into the "Source files" of the client project, and using it to make the build for client project.
thanks in advance,
George
|
|
|
|
|
Hi,
I think you should ask in this Link[^]
The price of anything is the amount of life you exchange for it.
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
Hello everyone,
When using debugger to attach to a process written by me, its type is T-SQL, x64 and Managed. What does T-SQL mean?
(my codes is using ADO.Net, does it mean all application which uses ADO.Net objects are type of T-SQL?)
thanks in advance,
George
|
|
|
|
|
I am creating a C++ App that uses ADO, problem is that it hangs at _ConnectionPtr.CreateInstance. i have tried looking up in goodle but havent been able to come up with a solution.
Below is my code.
any help would be greatly appreciated.
ADODB::_ConnectionPtr m_Conn;
BOOL ConnectionIsAvailable()
{
BOOL bRESULT = FALSE;
CoInitialize ( NULL );
try{
HRESULT hr =
m_Conn.CreateInstance(
__uuidof (ADODB::Connection ) );
if( FAILED ( hr ) )
throw _com_error( hr ) ;
m_Conn ->Open( L"DSN=DSNNAME",
L"",
L"",
ADODB::adConnectUnspecified );
bRESULT = TRUE;
}
catch(_com_error &e )
{
string sMess = "Error connecting to the database : ";
sMess += e.ErrorMessage() ;
WriteToLog( ( char* )sMess.c_str() );
}
return bRESULT;
}
|
|
|
|
|
Hzello evry body !
I have this problem :
I have C++ application with diverse dependencies upon libraries,etc
For many reasons, there is a certain central dir, where a post-build event script for each libs
copies the public .h files as well as the .dll and the .lib.
The client application only has to include the files in that dir and look for the libs as well in order to succesfully link.
My only pbm is when debugging this latter application. The call stacks shows problems happening in the code of some of those libraries, but the debugger source window never shows but the disassembly code.
Is there a way how to tell the debugger where to look for the source code ?
Thank you in advance.
Our Philosophy, Mohammed Baqir Al Sadr
|
|
|
|
|
How can I get the language identifier (maybe the term "keyboard layout" is more suitable) of a window that belongs to another application?
(e.g En, Fa, Ar, ...)
Thank you masters!
|
|
|
|
|
GetThreadLocale ?
Our Philosophy, Mohammed Baqir Al Sadr
|
|
|
|
|
Not for local thread, I said for a thread that has created a specific window (e.g foreground window) in another application.
Thank you masters!
|
|
|
|
|
In that case I do'nt think if there would be a certain GetLocale function that would accept a thread handle then retrieve the corresponding threads'locale, instead of the current thread that is calling the function.
May be if you manage to trigger that remote thread to execute specific code where you call GetThreadLocale, store its result and then somehow communicate it back then the pbm is solved.
Of course I am making the hypothesis that you can alter the target application source code.
Otherwise may be someone else has another solution.
Our Philosophy, Mohammed Baqir Al Sadr
|
|
|
|
|