|
glad it helps.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
remove the stuff you wrote in the stdafx.h. In your dll project place "_EXPORT_GUI_LIB_" in the preprocessor definitions (project settings). This way the classes will be exported when you have defined "_EXPORT_GUI_LIB_" and imported if not defined (as in your client project). Hope this explains it a bit.
Er zit een korstje op mijn aars.
|
|
|
|
|
Hi,
I have an MFC ActiveX application and on a certain scenario (timing dependent I think) it crashes
with either an "Access Violation" or "Invalid Instruction", and the call stack simply shows:
"GUI! _except_list". I don't get any source file where the crash occured, just some disassembly which doesn't look like valid code (About 100 lines of the same code line in assembly - mov
dword... repreated 100 times or more).
I used BoundsChecker with maxium error checking, but it didn't catch anything.
Any ideas how to catch this?
Thanks.
|
|
|
|
|
Check your *.pdb files. This is where your debugger gets the symbols.(source codes) when debugging.
Hope this helps
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hi,
I found the "except_list" string in my PDB, but it doesn't really tell me anything.
Here's a part of the PDB with the except_list in it.
Every line has an address on the left side, but I didn't add those here.
AfxGetApp@@YGPAVCWinApp@@XZ \q??_7CGUIDlg@@6B@* _numega_finalcheck_Y_110455" 8a??0CStatic@@QAE@XZ* ü]??0CDialog@@QAE@IPAVCWnd@@@Z" g___CxxFrameHandler
__except_list g__EH_prolog& Ô?OnCancel@CGUIDlg@@EAEXXZ" W?OnOK@CGUIDlg@@EAEXXZ" ¾\??3CObject@@SGXPAX@Z" Y??1CGUIDlg@@UAE@XZ2 `#?ReleaseInstance@GUI_MsgMngr@@SAXXZF ‰49?UnregisterMsg@GUI_MsgMngr@@QAEXW4MsgID@@W4ObjectID@@HH@Z2 "#?GetInstance@GUI_MsgMngr@@SAPAV1@XZ" 0__imp__DeleteObject@4>
What can I do with this info?
Thanks.
|
|
|
|
|
You need to have your *.pdb files to be with your *.ocx.
And one more point in case you have forgotten. You need to have your project build in debug mode.
hope this helps
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
I think I misunderstood your first post. I thought you meant I need to open my PDB file to check it's contents. I guess you meant to make sure I even have a PDB file.
I do have PDB files for each project, and everything is compiled in debug. On "normal" crashes I do get a normal call stack and can debug normally. On this specific crash the only thing in the stack is: "GUI! __except_list" with no source code.
This only happens on my computer. The same version runs fine on other computers in the company, so it's either something specific which is problematic in my computer, or a specific timing sequence that only happens on my computer and causes it to crash.
Thanks anyways.
|
|
|
|
|
Hi,
Some years ago I had to develop an Windows Service, and it didn't used MFC... now I wonder... it's possible to include MFC on a Windows service ?, How can I do that ?
Thanks in advance, Greetings
Braulio
|
|
|
|
|
Hi,
Create NT Service using ATL COM appwizard.
In StdAfx.h file, include <afx.h> as shown below
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <afx.h>
//#define STRICT
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
Now u can use MFC in Service .
Cheers,
Anand
The chosen One
|
|
|
|
|
There is an easy way aswell , User CreateService API , it's takes an Excutable Name and register that as a service .
Atif
|
|
|
|
|
Hello, everyone!
I want to write a console application using VC++ 6.0 to invoke IE to load a html file which
resides on the same path of my application.
My trouble is, I do not know how to locate the executable file of IE, I want to write a
machine independent application and it is impossible to hard code the path of IE in my
program. Maybe I should read from registry or environment variable?
Who can help? Can you give me a sample?
Thanks in advance,
Geo
|
|
|
|
|
CreateProcess will look up the path to the executable, although this isn't that advisable (because an attacker could substitute a different IEXPLORE.EXE earlier in the path).
You might be better off using ShellExecuteEx directly on your HTML file, which will load the program registered to open HTML files.
|
|
|
|
|
Thanks, Mike buddy!
I have make a reference of MSDN of ShellExecuteEx. I have never used this function before, and I find the SHELLEXECUTEINFO Structure is too complicated. So, can you tell me how to fill the value of each fields of this structure in my simple example?
regards,
Geo
|
|
|
|
|
I'd suggest something like:
SHELLEXECUTEINFO sei = { 0 };
sei.cbSize = sizeof( sei );
<font color="green">
sei.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_FLAG_DDEWAIT;
sei.lpVerb = _T( "open" ); <font color="green">
sei.lpFile = _T( "myfile.htm" );
sei.nShow = SW_SHOWNORMAL; I've used the SEE_MASK_FLAG_NO_UI flag to prevent any message boxes coming up if there's an error. I've also added SEE_MASK_FLAG_DDEWAIT to ensure that launching the file using DDE works - Internet Explorer uses DDE to reuse an existing window if the user has IE configured that way.
You could leave the lpVerb variable set to NULL in order to use the user's default verb (the one in bold when right-clicking an HTML file) but the user could potentially have set this to do something different, rather than Open.
|
|
|
|
|
Thanks, Mike buddy!
I have tried your method in my VC++ 6.0 console application, but there are 5 errors. Here are the source codes:
Source Code:
----------
#include <shellapi.h>
#include <windows.h>
int main (int argc, char** argv)
{
SHELLEXECUTEINFO sei = { 0 };
sei.cbSize = sizeof( sei );
// Add the SEE_MASK_NOCLOSEPROCESS flag
// if you want to wait until the browser is closed
sei.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_FLAG_DDEWAIT;
sei.lpVerb = _T( "open" ); // Could leave NULL
sei.lpFile = _T( "myfile.htm" );
sei.nShow = SW_SHOWNORMAL;
//ShellExecute(0, "open", "iexplore.exe", "http://www.codeguru.com", "c:\\", SW_SHOWNORMAL);
ShellExecuteEx (&sei);
return 0;
}
----------
Here are the error messages:
----------
c:\program files\microsoft visual studio\vc98\include\shellapi.h(53) : error C2065: 'HDROP' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\shellapi.h(53) : error C2501: 'DECLARE_HANDLE' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\shellapi.h(55) : error C2146: syntax error : missing ';' before identifier 'UINT'
c:\program files\microsoft visual studio\vc98\include\shellapi.h(55) : error C2501: 'DECLSPEC_IMPORT' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\shellapi.h(55) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
LoadHtml.exe - 5 error(s), 0 warning(s)
----------
Can you help?
regards,
Geo
|
|
|
|
|
The documentation doesn't explicitly say so, but shellapi.h has dependencies on the Windows base headers. Include windows.h before any other Windows headers.
|
|
|
|
|
|
Hi!
when I exports a class where I mixed managed and undmaged code and in an another dll try to use the exported class (declared as 'gcroot<cdedusetpdb*> m_SetPDB;' ) I receive the following error when compileing. Why?
I have compiled with option /clr.
DAkut error LNK2020: unresolved token (06000065) CDeDUSetPDB::.ctor
DAkut error LNK2020: unresolved token (06000066) CDeDUSetPDB::Finalize
DAkut error LNK2020: unresolved token (06000067) CDeDUSetPDB::Login
The exported class look like this:
#pragma once
#ifdef IMPL_DPDB
#define CLASS_DECL_DPDB _declspec(dllexport)
#else
#define CLASS_DECL_DPDB _declspec(dllimport)
#endif
#include <afx.h>
#using <mscorlib.dll>
#include <vcclr.h>
#using <system.dll>
#using <system.data.dll> // This is required for the ADO.NET Provider
#using <system.web.services.dll>
#using "c:\Inetpub\wwwroot\DeDUWebService\bin\DeDUWebService.dll"
using namespace System::Runtime::InteropServices;
using namespace System::Web::Services;
using namespace DeDUWebService;
// CDeDUSetPDB
class CLASS_DECL_DPDB CDeDUSetPDB : public CObject
{
// DECLARE_SERIAL(CDeDUSetPDB)
private:
short m_nValue;
public:
// uncomment the lines below to avoid the compiler errors
CDeDUSetPDB() {};
CDeDUSetPDB( const CDeDUSetPDB &s ) // copy ctor
{ m_nValue = s.m_nValue; }
CDeDUSetPDB& operator=( const CDeDUSetPDB &s ) // assignment operator
{ m_nValue = s.m_nValue; return *this; }
// Loggar in på DeDU Databas
int Login(char* szNamn, char* szPwd)
{ return ws->Login(szNamn,szPwd); }
protected:
gcroot<deduservice*> ws;
};
MSc Bertil Morefält
|
|
|
|
|
if you wanted to use a managed object
you will need to declare your class like
__gc class Someclass //to indicate the class is garbage collectable.
hope this helps.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
I tried that.
I want to export the hole class so
I declared the class like this
_gc class _declspec(dllexport) Someclass // The compile dosn't allow it.
Why?
MSc Bertil Morefält
|
|
|
|
|
If your managed class in already in DLL form which is a assemblies. You can straight up to utilize it in C#, VB.NET , J# and etc.
But if you like to consume a managed component from an unmanaged. You will need to export the assembly hosting the managed component into a COM type library, which an unmanaged, COM-aware client.
The command of generating the TLB is as follow
> regasm YourManaged.dll /tlb:YourManaged.tlb
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
We are running our c++ program as Windows services which uses JNI, . Program is getting CLASSPATH env variable correctly and also initializes JVM successfully. After initializing JVM, programs makes a JNI call FindClass() for getting java class.But FindClass method returns NULL even though java class exists in the CLASSPATH.
Same program when is run from command window, FindClass method call is working fine.
Is there any difference between running a program thru command window and as a windows service ?
Incase you have any idea on how to resolve this issue, kindly get back ASAP.
Best Regards,
sarathy
|
|
|
|
|
As a Windows service, your code is running under a different security context - for example, it is not an interactive user, it's running in a service logon. The difference here is that as an interactive user your process token includes the INTERACTIVE Security Identifier (SID), whereas as a service it instead includes the SERVICE SID.
The difference in SIDs or user accounts might lead to an access-denied error if the Access Control List on your class file is too strict. I suggest using SysInternals FileMon to investigate. See the SysInternals NT tools page[^].
|
|
|
|
|
i want to add an icon to a tree control but i can't. please tell me how can i do it .which section of this code is wrong?
CTreeControl m_tree;
CImageList img;
HICON hicon;
hicon=LoadIcon(IDR_MAINFRAME);
img->Add(AfxGetApp()->hicon);
m_tree.SetImageList(img, TVSIL_NORMAL);
|
|
|
|
|
First thing:
The SetImageList-call wants the pointer to an imagelist - but maybe that is a typo, as the compiler would be telling you that clearly.
Second thing:
Is it OK to let the ImageList-object you just introduced to the TreeCtrl go out of scope?
Maybe you need to make it a member?
Here is what I do (but note that I fill the imagelist with bitmaps!):
m_TreeImageList.DeleteImageList();
if(m_TreeImageList.Create(16,16,ILC_MASK,8,0))
{
std::vector<unsigned int> bmpId;
bmpId.push_back(IDB..);
bmpId.push_back(IDB..);
[...]
CBitmap bmp;
m_TreeImageList.SetBkColor(GetSysColor(COLOR_WINDOW));
for(unsigned int i = 0; i < bmpId.size(); ++i)
{
int b = bmp.LoadBitmap(bmpId[i]);
b = m_TreeImageList.Add(&bmp,(COLORREF)0xFFFFFF);
bmp.DeleteObject();
}
}
else
{
AfxMessageBox("ImageList Creation Failed!");
}
m_MyTree.SetImageList(&m_TreeImageList, TVSIL_NORMAL);
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|