|
Somehow, I've lost the controls palette used for creating controls on a dialog box. How do I get it back?
Thanks in advance.
John P.
|
|
|
|
|
Go to Tools --> Customize --> Toolbars tab
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Right click on the tool bar and check on the option controls to get the controls palette
|
|
|
|
|
Does a setup file of an application created to be distributed via a CD differ from one created to be distributed via the web?
Fortitudine Vincimus!
|
|
|
|
|
No it need not be. Atleast we haven not used a different setup file for CD and a different setup file in the web. The only additional stuff in the CD could be the Autorun file which will be absent in the web.
HTH
|
|
|
|
|
Thanks.
Fortitudine Vincimus!
|
|
|
|
|
I have created a DLL (Hook.dll) in unicode using .net 2003. The builder use vc++. I am loading the dll dynamically with an hook into a target process (Main.exe) with an dll injector.
BOOL APIENTRY DllMain (HMODULE hDll, DWORD reason, PVOID lpReserved)<br />
{<br />
if(Reason == DLL_PROCESS_ATTACH)<br />
{<br />
DisableThreadLibraryCalls(hDll);
I have a function within the DLL(Hook.dll) that tries to get the DLLs(Hook.dll) file name and path (fullpath with filename of Hook.dll).
this is the original code, this code gets and reads the crc32 checksum of the Main.exe:
pEXEFile = fopen(pszEXEFileName, "rb");
now i have changed it to and can fopen and read the dll, when i use::
pDLLFile = fopen("C:\\Documents and Settings\\Shawn\\Desktop\\Hook.dll", "rb");
this code above works, it will open my dll and read it's crc32 checksum, when i place and load the dll from my desktop.
another code that works:
pDLLFile = fopen("\\Hook.dll", "rb");
this last code above works, when i move the Hook.dll into the same folder where the Main.exe is.
I thought that because I used LoadLibrary to load the DLL that it would be
in its own application space. So I figured I could just use the DLLs
Application component to extract the file name using GetModuleFileName
However, I was supprised to find that the returned name was the main
application not the DLL.
Is there another way to get the DLLs files name when dynamically loading it or is their a better way to use GetModuleFileName?
The problem is I do not know what directory the DLL was in when i inject the dll into the main program and I need to figure this out at run time.
what im trying to do is, get the fullpath to the injected dll at runtime, fopen the dll then to read it in binary mode and get a crc32 hash from the dll, check the retrieved crc32 checksum and validate the dll, if the dll was altered, exit the Main.exe.
i got some example code and need now some help, how could i bring the code to give me the fullpath of my loaded module "Hook.dll" from the Main.exe
example codes:
extern HINSTANCE _hInstance;<br />
<br />
const char *OurFileName()<br />
{<br />
static char our_filename[MAX_PATH + 1];<br />
<br />
if (!*our_filename)<br />
{<br />
GetModuleFileName(_hInstance, our_filename, sizeof(our_filename);<br />
}<br />
<br />
return our_filename;<br />
}
You can do something like this to get path of a loaded module: <br />
<br />
HMODULE hmod = NULL; <br />
<br />
LPCTSTR lpszModuleName = TEXT("MyLibrary.dll"); <br />
<br />
TCHAR szPath[MAX_PATH + 1] = {0}; <br />
<br />
hmod = GetModuleHandle(lpszModuleName); <br />
<br />
if (!hmod) <br />
<br />
<br />
GetModuleFileName(hmod, szPath, MAX_PATH); <br />
<br />
FreeModule(hmod); <br />
<br />
This copies path to the module into szPath.
Thanks for every help
Shawn
|
|
|
|
|
I'm coding a program which gives a stimuli and wait for the user's answer before giving another one. The user answer by pressing one of 2 keys, and at the moment the program seems to be storing extra key pressed for the next stimulis. For example, if the user is asked to answer a question but presses twice the key, the second hit is used to answer the next question. Could anyone point me to a way of flushing all these keypresses before asking the user for the real one? Thanks in advance,
I'm using a windows form and the KeyPress event handler (which I'm really not yet comfortable with) and visual c++ studio express
//Code in the form1 constructor :
this->KeyPress += gcnew KeyPressEventHandler(this, &Form1::Form1_KeyPress);
Form1::KeyPreview = true;
//Code for the function
void Form1_KeyPress(Object^ sender, KeyPressEventArgs^ e)
{
// Here I handle the key
}
Simon
|
|
|
|
|
i wonder if someone could help me with an issue im having converting a hex value to a binary string..
i am trying to convert the hex string 0x00C000000000 to binary which should work out to be 1100000000000000000000000000000000000000.
i am using std::stringstream to fist convert the hex value to decimal and this is where it seems to be failing.. for the hex string 0x00C000000000 the decimal equivalent should be 824633720832 but i am not getting that..
here is my code
<br />
<br />
std::string hexvalue = "00C000000000";<br />
std::string binary = "";<br />
<br />
long decimalVal;<br />
<br />
std::stringstream sstr(hexvalue);<br />
sstr >> std::hex >> decimalVal;<br />
<br />
std::ostringstream out;<br />
long digit;<br />
bool nonzero = false;<br />
<br />
for (long i = 31; i >=0; i--)<br />
{<br />
digit = (decimalVal >> i) & 1 ;<br />
if (!nonzero && digit)<br />
nonzero = true;<br />
<br />
if (nonzero)<br />
out << digit;<br />
}<br />
<br />
binary = out.str();
by the way, if i set hexvalue to a smaller number then it seems to work. for example.
std::string hexvalue = "12";
can anybody help me out here?
thanks in advance
|
|
|
|
|
doh!!! im a muppet... its always the way isnt it.. no sooner than you ask for help to a problem then you realise what your doing wrong! hehe
as soon as i hit the send button i realised my small "long" was to small, and so ive changed it to __int64 and all is sound!! - ignore me all
std::string hexvalue = "00C000000000";<br />
std::string binary = "";<br />
<br />
__int64 decimalVal;<br />
<br />
std::stringstream sstr(hexvalue);<br />
sstr >> std::hex >> decimalVal;<br />
<br />
std::ostringstream out;<br />
__int64 digit;<br />
bool nonzero = false;<br />
<br />
for (__int64 i = 50; i >=0; i--)<br />
{<br />
digit = (decimalVal >> i) & 1 ;<br />
if (!nonzero && digit)<br />
nonzero = true;<br />
<br />
if (nonzero)<br />
out << digit;<br />
}<br />
<br />
binary = out.str();
-- modified at 11:26 Monday 7th August, 2006
|
|
|
|
|
Hello,
How can change the working directory of NT service from WINNT\system32 to the
exe directory (C++ unmanaged)?
Thanks,
|
|
|
|
|
|
Use GetModuleFileName(NULL, ...) to get the EXE's folder. Use that with SetCurrentDirectory() .
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
If you are bent at using crt routines, then _chdir would do that. Be aware that this routine would internally call the win32 api, SetCurrentDirectory.
|
|
|
|
|
See
SetCurrentDirectory(for set directory)<br />
GetCurrentDirectory(for get current directory)
|
|
|
|
|
We recently switched a rather large project (7 projects in this workspace) from VS2002 to VS2005. This was in anticipation of supporting 64-bit apps, so we had a lot of details to straighten out before we had a working build.
Once the dust had settled, I realized that the browse info for the system no longer works. Whenever I click a symbols name and press F12, for a symbol defined in one of our projects, I get the message "The symbol 'whatever' is not defined." Symbols defined by MFC are handled correctly.
Now, the wierd part: the settings for browse info are all correct, as far as I can tell; I get the correct progress message when thge browse info is created; and the browse info files are where they should be (in the same directory as my .objs). But for some reason, VS2005 can't find them!
Any idea what might be wrong here?
|
|
|
|
|
I am dynamically adding content to a CDialogBar - when the on-screen capacity is reached i want to add a scrollbar to allow the content to be visable.
I understand that CDialogBar will not allow a Scrollbar - so i'm not really sure what to do. I'm quite limted with a CDialogBar as i need it as part of MDI.
Any help appreciated!
-- modified at 11:05 Monday 7th August, 2006
|
|
|
|
|
|
I was trouble by this problem for a long time!
I insert a new dialog template which ID is IDD_DLG_MYDLG
and create a new dialog class named CMydlg;
and I use this dialog in my application :
ex:
void CMyapp::showDlg(CString str)<br />
{<br />
CMydlg *dlg=new CMydlg;<br />
dlg->Create(IDD_DLG_MYDLG, this);<br />
dlg->ShowWindow(1);<br />
dlg->SetWindowText(str);
}
Now, I click one button to show my dialog
ex:
void CMyapp::showMydlg(void)<br />
{<br />
showDlg("my dialog 1");<br />
showDlg("my dialog 2");<br />
}
then, I want to know that the first dialog I created is close or still active,
I don't know how to specify that the dialog , which has some mark to specify it, or else , I use the function showMydlg, it will create lots of dialog, I want to show it if it was not created, or create it if it is not showing!
if some one know ,please tell me , it was so trouble thing, that some one use my application, who continuously clicked one button , so many dialog show make me shy!
if you know what I mean , please give me a better way to solve it !
waiting for answers online!
Just my interest for these common things
|
|
|
|
|
First, the problem with your code is that you have a pointer local to a function (the CMydlg *dlg pointer which is in showDlg). You allocate memory for this pointer but when you reach the end of the function, you don't have any grasp over the pointer anymore. Thus, this will result in a memory leak. Instead of making it local in the function, make it a member of your class (CMyapp). This way, you can control if this dialog is already created (pointer points to a valid dialog class) and you can retrieve the status (if the dialog is visible or not).
And, furthermore, there is no need to make it a pointer, just show/hide it with the CWnd::ShowWindow function.
|
|
|
|
|
I know what you mean, you say that I make it a member of my dlg class.
that creating it when I use it ,and assert it , and show it correctly,
is it?
But the problem is that :
I create a CListCtrl,
and add many item at it !
You know the ICQ:
I simulate it ,
when I dbclicked one item, show a dlg(this dlg is diffrent by its content),
If I dbclicked the same item, show the dlg I just created!
but if the list has so many items, ex 1000,
shall I prepare 1000 pointer at my application as a member at a class?
so I want to find a way that I want to create it when I want to show it !
just I want to decrease the class member pointer!
If it's no way , I think I only use dlg* mydlg[1000] to solve it !
Just my interest for these common things
|
|
|
|
|
xuwenq88 wrote: but if the list has so many items, ex 1000,
shall I prepare 1000 pointer at my application as a member at a class?
So, you have also 1000 different dialog templates ?
Or is it the same dialog but with different data in it ?
In the latter case, you can simply pass the data to the dialog before making it visible.
|
|
|
|
|
I think it so long time, does the clist or ctypedptr can solve it?
Just my interest for these common things
|
|
|
|
|
hi i had written the code to block the specific port using packet filtering API,all work fine but "Pfbindinterfacetoindex" execute successfully but did not block the port so i googled and find another API pfbindinterfacetoindex but it still fails the only problem could be here where give index
GetIpAddrTable( NULL, &dwIface, FALSE);
pIpTable = (PMIB_IPADDRTABLE) malloc(sizeof(PMIB_IPADDRTABLE));
GetIpAddrTable(pIpTable,&dwIface,FALSE);
for (pIpAddr = &pIpTable->table[ dwIface = 0]; dwIface < pIpTable->dwNumEntries; ++dwIface)
++pIpAddr;
PfBindInterfaceToIndex(ihandle,pIpAddr->dwIndex,PF_IPV4,(PBYTE)ip);
tell me what is wrong with this why this is not working i had spend atleast a 1 and half week on that but was failing.
Tasleem Arif
|
|
|
|
|
Maybe instead of
GetIpAddrTable( NULL, &dwIface, FALSE);
pIpTable = (PMIB_IPADDRTABLE) malloc(sizeof(PMIB_IPADDRTABLE));
. . .
you should try this:
dwIface = 0;
GetIpAddrTable( NULL, &dwIface, FALSE);
pIpTable = (PMIB_IPADDRTABLE)malloc(dwIFace);
. . .
I hope it helps.
|
|
|
|
|