|
Hi all,
I made a dialog a preference page of some sort that transacts with the system registry. Then after i finished it i was instructed to make it a tab and have another tab. I tried that by doing this:
CPropertySheet sheet( _T("Preference"), 1 );
CPropertyPage<IDD_PREFDLG> pgPreference;
sheet.AddPage(pgPreference);
sheet.m_psh.dwFlags |= PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP;
sheet.DoModal ( *this );
Now it cannot initiate and load the functions its just the dialog thats loading and my buttons and the contents of my combobox doesnt work. What do i need to do?
This is the whole initdialog:
LRESULT CPrefDlg::OnInitDialog(UINT , WPARAM , LPARAM , BOOL& )
{
CenterWindow();
HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDD_PREFDLG),
IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR);
SetIcon(hIcon, TRUE);
HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDD_PREFDLG),
IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
SetIcon(hIconSmall, FALSE);
DWORD dwDisp;
TCHAR szKey[256];
szKey[0] = _T('\0');
_tcscpy(szKey, ServiceRegEntry);
_tcscat(szKey, UPDATEMGR);
_tcscat(szKey, ServiceParam);
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey,
0, 0, REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS, NULL, &Regentry, &dwDisp))
{
printf("Could not create the registry key.");
return 0;
}
BufferSize = TOTALBYTES;
PPERF_DATA_BLOCK PerfData = (PPERF_DATA_BLOCK) malloc( BufferSize );
AttachItems();
QueryAutoCheck();
QueryAutoDownload();
QueryDownloadDay();
QueryDownloadTime();
QueryPath();
QueryEmail();
QueryReRite();
QueryMP();
CenterWindow(GetParent());
QuerySetProd();
RegCloseKey(Regentry);
Regentry = NULL;
delete Regentry;
return TRUE;
}
Thanks!,
jayjay
|
|
|
|
|
hi to all , i have 2 enum on my IDL file :
interface myInterFace
{
typedef enum RPTR_RETRACTBIN_STATUS
{
RPTR_RETRACTBIN_OK,
RPTR_RETRACTBIN_FULL,
RPTR_RETRACTBIN_HIGH,
RPTR_RETRACTBIN_NOT_SUPPORTED,
RPTR_RETRACTBIN_UNKNOWN
}RPtrRetractBinStatus;
...
HRESULT SyncRetract([out,retval] RPtrRetractBinStatus * status);
}
library myLIB
{
typedef enum RPTR_RETRACT_TRESHOLD
{
RPTR_THRESHOLD_RETRACTBIN_FULL,
RPTR_RETRACTBIN_HIGH
}RPtrRetractThreshold;
...
dispinterface _IXFSReceiptPrinterEvents
{
properties :
methods:
HRESULT StackOK(RPtrRetractThreshold reason);
};
...
}
after compile i have this error ::>> redefinition : RPTR_RETRACTBIN_HIGH
what is its solution ?(NOTE : i can not rename any enum members)
|
|
|
|
|
Hello Friends,
I am having a c++ ATL DLL built in VC 6.0
And Vista's DEP blocks it, As I found that we can set the NXCOMPAT bit (IMAGE_DLLCHARACTERISTICS_NX_COMPAT) to mark it DEP compatible so that Vista DEP will allow it to run.
by following command: (as post build step)
editbin.exe /NXCOMPAT <your binary="">
but I want to do the same in VC 6.0, and we dont have editbin command or NXCOMPAT bit in VC 6.
It's in Visual Studio 2005 and later versions.
Kindly tell me how to do the same as there must be some way out other than this command so that DEP will not block my DLL built in older vc++ 6 compiler.
Please Help!!!
dolly,
N,IN
|
|
|
|
|
Before you think about that - are you using CWindow objects? ATL 3.0 (&7.1, IIRC) relied on constructing code thunks in data memory to perform dispatching of window messages to C++ objects. This is precisely the sort of code that DEP is intended to protect against.
If you believe your DLL is OK - what's to stop you using the editbin.exe from VS2005? To make it easier, copy it into your solution's root directory and use it from there.
|
|
|
|
|
Stuart Dootson wrote: Before you think about that - are you using CWindow objects? ATL 3.0 (&7.1, IIRC) relied on constructing code thunks in data memory to perform dispatching of window messages to C++ objects. This is precisely the sort of code that DEP is intended to protect against.
If you believe your DLL is OK - what's to stop you using the editbin.exe from VS2005? To make it easier, copy it into your solution's root directory and use it from there.
------------------------------------------------------------------
Hi and thanks for replying!
I am using a simple ATL 3.0 c++ DLL project, and compiling it through Visual C++ 6.0
editbin.exe is not working even if i explicitely copy it in my root folder along with the required DLLs and exes it needs to execute.
It says unrecognized option /NXCOMPAT and is ignored!
I read some where that VS 2005 onwards every compiled page has IMAGE_DLLCHARACTERISTICS_NX_COMPAT bit set, which makes it DEP compatible, but we dont have such bit setting option in earlier VS versions. That is the main issue with me!
But I am sure there is some way of running the old built DLLs so that DEP will not stop them.
I am using ATL for the first time, so trying hard to find a way out!
Please help if u can!
Thanks a lot!
dolly,
N,IN
|
|
|
|
|
Here's a program I knocked together which will set the bit for you. It's been tested so I know it works.
#include "stdafx.h"
#include <windows.h>
#include <tchar.h>
#include <Imagehlp.h>
#include <shlwapi.h>
#include <malloc.h>
#include <iostream>
#include <string>
#pragma comment(lib, "Imagehlp.lib")
#pragma comment(lib, "shlwapi.lib")
using namespace std;
#ifndef IMAGE_DLLCHARACTERISTICS_NX_COMPAT
# define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
#endif
#ifdef UNICODE
# define tcout wcout
# define tcerr wcerr
typedef wstring tstring;
#else
# define tcout cout
# define tcerr cerr
typedef string tstring;
#endif
void PrintUsage()
{
tcout << _T("Usage:") << endl;
tcout << _T("\tSetNXCompat <file>") << endl;
}
bool Worker(LPCTSTR pDir, LPCTSTR pFile)
{
LOADED_IMAGE li;
BOOL ok = MapAndLoad(
const_cast<LPTSTR>(pFile),
const_cast<LPTSTR>(pDir),
&li,
FALSE,
FALSE
);
if (!ok)
{
return false;
}
IMAGE_NT_HEADERS *pHeaders = li.FileHeader;
pHeaders->OptionalHeader.DllCharacteristics |= IMAGE_DLLCHARACTERISTICS_NX_COMPAT;
DWORD org_sum;
DWORD new_sum;
IMAGE_NT_HEADERS *pNT = CheckSumMappedFile(
li.MappedAddress,
li.SizeOfImage,
&org_sum,
&new_sum
);
if (pNT != NULL)
{
pNT->OptionalHeader.CheckSum = new_sum;
}
else
{
tcerr << "WARNING: Failed to update checksum." << endl;
}
ok = UnMapAndLoad(&li);
return (ok) ? true : false;
}
int main(int argc, TCHAR* argv[])
{
if (argc != 2)
{
PrintUsage();
return -1;
}
tstring dir;
if (PathIsRelative(argv[1]))
{
DWORD len = GetCurrentDirectory(0, NULL);
LPTSTR pBuffer = static_cast<LPTSTR>(_alloca((len+1)*sizeof(TCHAR)));
GetCurrentDirectory(len+1, pBuffer);
dir = pBuffer;
}
else
{
dir = argv[1];
tstring::size_type pos = dir.find_last_of(_T("\\/"));
if (pos == -1)
{
tcerr << "Error in file path!" << endl;
return -2;
}
dir.erase(pos);
}
if (!Worker(dir.c_str(), argv[1]))
{
tcerr << "Failed!" << endl;
return -3;
}
return 0;
}
Steve
modified on Friday, July 11, 2008 3:33 AM
|
|
|
|
|
5 for you - answers don't get much more helpful than that
|
|
|
|
|
|
Hi Steve,
Thanks so much for your reply!
I tried running the code you posted, and it seems to work well too, but still my plugin dll is blocked by Vista's DEP.
OR
I am not clear with how and when exactly to execute this code of yours!!
Actually I build my add-in DLL and then run a "Lanucher.exe" which registers the dll in windows registry!
I made a "NXSet.exe" which invokes your "worker()" and I called NXSet.exe from my ATL add-in project's Post-Build Step as below:
NXSet.exe "$(TargetPath)"
and then my addin DLL gets registered in Windows Registry by custom build step!
I also done both the things in custom build step...together...and when I checked it actually was successful in setting the IMAGE_DLLCHARACTERISTICS_NX_COMPAT bit in the DLL.
but still DEP block my addin DLL.
Is there anything else I need to do, so that Vista DEP does not block my DLL?
I am giving the absolute add-in DLL path in the command line argument for executing your "worker()" thru my sample exe.
I am doing something wrong or misplaced??
Please tell, as when i run your code, it runs well without any error.
Thanks Steve!
dolly,
N,IN
modified on Monday, July 21, 2008 12:03 AM
|
|
|
|
|
The problem is that you did not read the documentation.
Setting the IMAGE_DLLCHARACTERISTICS_NX_COMPAT does NOT "make your DLL DEP compatible".
This is your invention only.
Already your question is wrong.
This flags tells Windows that your DLL IS already DEP compatible.
If it is not, setting this flag is wrong.
The correct solution is to use SetProcessDEPPolicy() to tell Windows NOT to use DEP on your process.
Or compile with linker option /NXCOMPAT:NO
modified 2-Jul-20 20:28pm.
|
|
|
|
|
It's extremely unlikely that "dolly" is still looking for an answer twelve years later.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I did not write my answer for "dolly".
This question has the highest ranking on Google.
It appears in the first place!
Anybody searching for IMAGE_DLLCHARACTERISTICS_NX_COMPAT on Google will come here.
|
|
|
|
|
In order to customize the "details" on the left pane of the Explorer. I have implemented IPersistFolder3, however the getDetailsEx didn't get
called when i select a virtual item, it only get called when i double click the item.
|
|
|
|
|
Hello Friends,
I am using Windows Vista and I am builing an c++ ATL DLL in Visual C++ 6.0, which is an addin DLL for Windows Mail. (Outlook Express)
When I run my Windows Mail, Vista's DEP (Data Execution Prevention) feature blocks it, and prompts that it blocked for security purpose as some other program tried to use windows mail data.
But I have to hook into Windows Mail as have to put an addin to customize its GUI.
I tried to turn DEP off for Windows Mail, but it didnt allow me (even in Full Admin Account).
Also I turned DEP off for my exe (which loads my addin DLL, which further hooks into Windows Mail), but despite that Windows Mail is blocked.
Also, when I build the project in Visual Studio 2005, it runs very well. (And I have not made any change in the project settings or code)
It seems, VC 6 uses older compilers and VS 2005 uses latest ones so are compatible with Vista!
But I have to use VC 6 only as it's my project's requirement!
Please Help!
Thanks a lot !!
dolly,
N,IN
|
|
|
|
|
That's because the version of ATL shipped with VC6 includes windowing code which is not DEP compliant.
To build an ATL windowing plug-in for a DEP enabled application I'm afraid you have no choice - you must build your code using Visual Studio 2005 or 2008.
|
|
|
|
|
Hello Friends,
I have an ATL project in Visual Studio 2005, but now I want it in Visual C++6.0.
I have used one utility available on Code Project only i.e.
prjconverter.exe
it converted .sln to .dsw BUT on building the project,
I am having many error, mainly
"C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(2945) : error C2065: '_Module' : undeclared identifier"
Because even in converted project,
class Coeapi_sampleModule : public CAtlDllModuleT< Coeapi_sampleModule >
{
public :
DECLARE_LIBID(LIBID_oeapi_sampleLib)
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_OEAPI_SAMPLE, "{2FB8F87B-D079-497D-8948-F2F060162392}")
};
Coeapi_sampleModule _AtlModule;
BUT
what I want (generated by compiler if we build in vc 6) is
CComModule _Module;
and i read that CComModule is obsolete now, but I have to use it anyway because I have to code & build the project in Visual C++ 6.0 only not in Visual Studio 2005.
Please Help.
Thanks well in Advance!
dolly,
N,IN
|
|
|
|
|
create a new project in Visual C++6.0, and merge your code in the new dll project
|
|
|
|
|
Hi all,
Is there a way to create a calendar control without the month and the year, I just need the days.
Thanks,
Jayjay
reposted at mfc
modified on Friday, July 4, 2008 1:33 AM
|
|
|
|
|
Hi
I want to get mouse move or click event on Internet Explorer ,
Through that I can get selected text form Internet Explorer .
Thanks in advance.
dabara
|
|
|
|
|
If you program an ActiveX you could capture both Events (but from the window of the Object)
JO
|
|
|
|
|
Hello,
I am trying to make an SDI applicaiton with a form view.
When this type of applicaiton is generated in MFC, the main window is sized according to the size of the dialog or the screen size.
If the window size is smaller than the dialog, scroll bars appear so that the dialog can be scrolled inside the view.
When I generate this same type of applicaiton in WTL, the dialog is clipped if the view size is smaller than the dialog, and the size is based only on the screen size.
I can change the size of the main window by initializing a rect in the Run function before calling wndMain.CreateEx(NULL,rc).
However, I would like to duplicate the functionality of the MFC applicaiton.
How do I get the correct size for the main window?
How do I get the scroll bars to appear if the view is smaller than the dialog?
|
|
|
|
|
I used ATL to realize my NSE. But I'd like to use DefView instead of customized list view in my NSE. So I had to implement IShellFolder2. However error(Heap corruption) happens every time when I debugging the NSE. Do you know what's the reason or how shall I implement the IShellFolder2.
|
|
|
|
|
|
I tried to download the mailer sample from http://msdn.microsoft.com/en-us/library/6c3k2z70(VS.80).aspx but everytime I get this message
========== Rebuild All: 0 succeeded, 0 failed, 2 skipped ==========
It is not building the project. everytime it just skips it. I do not know what does that mean? How can I get this code to compile? I am using VS 2008, win XP.
Thanks.
the fruits of your success will be in direct ratio to the honesty and sincerity of your own efforts in keeping your own records, doing your own thinking and, reaching your own conclusions.
..surviving in autumn..in love with spring..
|
|
|
|
|
you must activate the projects in the build manager. You find it in the "Build" Menu.
Greetings from Germany
|
|
|
|
|