|
RChin wrote:
take a look at this Post[^]
Sorry, I need to get the hang of posting correct hyperlinks
I meant
This One[^].
I Dream of Absolute Zero
|
|
|
|
|
|
One solution is ShellExecute().
Kuphryn
|
|
|
|
|
|
i want to have a toolbar on the right hand and i want to add its buttons from right to left.please tell me how could i do it?
|
|
|
|
|
Hi!
I'm doing my first capture program and having an error message like:
/home/steve/tmp/ccNeGS6x.o(.text+0x1e): In function `main':
: undefined reference to `pcap_lookupdev'
/home/steve/tmp/ccNeGS6x.o(.text+0x7b): In function `main':
: undefined reference to `pcap_lookupnet'
collect2: ld returned 1 exit status
Does anyone know what is wrong?? I'm using the library pcap.h
|
|
|
|
|
You've included the header OK.
But you need to include the appropriate lib file to your project. If you look at
your documentation for pcap (I assume there is some!), it will point to a lib file
(e.g. pcab.lib). Just add the lib file to your project settings, and away you go.
Iain.
|
|
|
|
|
I am using a web browser control (actually the CHtmlStatic class found
in codeproject, but it's the same) to display some html and at some
point in my html document I have a button that calls window.print().
The problem is, if the option to print background colors and images
is not true in internet explorer's settings, my document will not print well.
So I need a way to get the registry key associated with that option
prior to displaying the html page, set it to true, show the page and
then set it back to the original value on return.
I have found the key:
HKEY_USERS\...(numbers ommited)...\Software\Microsoft\Internet Explorer\Main\Print_Background
which is probably the per user option, but how do I get and set it
at runtime?
Thanks in advance.
Have no fear of perfection - You will never reach it
|
|
|
|
|
You need the registry functions. Do a search for (e.g.) RegOpenKeyEx, and you will see the rest.
You will want:
RegOpenKeyEx
RegQueryValueEx
RegSetValueEx
RegCloseKey
Good luck,
Iain.
|
|
|
|
|
Thanks Iain, but my question is about finding at run time *which
key* to set, rather than which function to use to set it.
The hard part is, since it seems to be a per user option, you
have to find out where msie keeps this option for the current user.
Have no fear of perfection - You will never reach it
|
|
|
|
|
Looking back at your question, I still think my answer was valid. But maybe that's my ego talking.
Anyway, I would lay *really* big odds that HKEY_USERS\...(numbers ommited)...\etc is the key that
is aliased by HKEY_CURRENT_USER\etc. Try changing a value in one, and see if that change is
reflected in the other.
HKCU is set when a user logs on, so it is safe on other machine, logins etc.
If you are unsure about specific keys, just get the RegMon[^] program from www.sysinternals.com[^].
A little bad news though. It is possible that the setting you are after is read when the explorer
control is created, rather than when used, which would ruin your plan. But its worth a go!
Iain.
|
|
|
|
|
Thanks again Iain,
I should've thought about using a utility like regmon myself, but...oh well.
It seems that the key that's changed is
HKLM\Software\Microsoft\Internet Explorer\AdvancedOptions\PRINT\BACKGROUND\CheckedValue
I think you're probably also right about having to change this value on control creation rather than on page display.
I'll do some tests and let you know how it works out.
Have no fear of perfection - You will never reach it
|
|
|
|
|
This is it:
In my dialog's OnInitDialog() :
HKEY hkeyIE;
if(RegOpenKeyEx(HKEY_CURRENT_USER,
"SOFTWARE\\Microsoft\\Internet Explorer\\Main",
0, KEY_ALL_ACCESS, &hkeyIE) == ERROR_SUCCESS)
{
ULONG nValSize = sizeof(m_strPrevIEPrintBGVal);
LPDWORD lpType = NULL;
if(RegQueryValueEx(hkeyIE, "Print_Background", 0, lpType, (BYTE*)(LPCSTR)m_strPrevIEPrintBGVal, &nValSize) == ERROR_SUCCESS)
TRACE("Registry key exists, prev value = %s\n", m_strPrevIEPrintBGVal);
TCHAR *strVal = _T("yes");
if(RegSetValueEx(hkeyIE, "Print_Background", 0, REG_SZ, (BYTE*)strVal, sizeof(strVal)) == ERROR_SUCCESS)
TRACE("Registry key found and written successfully.\n");
else
TRACE("Registry key found but writing failed.\n");
}
else
TRACE("Registry key not found!\n");
and in OnCancel() or OnOk() :
HKEY hkeyIE;
if(RegOpenKeyEx(HKEY_CURRENT_USER,
"SOFTWARE\\Microsoft\\Internet Explorer\\Main",
0, KEY_ALL_ACCESS, &hkeyIE) == ERROR_SUCCESS)
{
if(RegSetValueEx(hkeyIE, "Print_Background", 0, REG_SZ, (BYTE*)(LPCSTR)m_strPrevIEPrintBGVal, sizeof(m_strPrevIEPrintBGVal)) == ERROR_SUCCESS)
TRACE("Registry key changed to previous value = %s.\n", m_strPrevIEPrintBGVal);
}
Works like charm...
Have no fear of perfection - You will never reach it
|
|
|
|
|
Those numbers according to user names are listed -among others- under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\hivelist, but I would recommend not to bother extracting it from there since you can extract the same from where you need it.
Therefore
1.enumerate all keys of HKEY_USERS with RegEnumKeyEx
2.Construct regkeys (HKEY_USERS + ...number... + rest of key) with the data found in 1./
3.Try opening the keys with RegOpenKeyEx
4.If successful, change their value as you need.
Peter Molnar
|
|
|
|
|
Thanks Peter,
I'm not sure I have to change the per user setting after all (look at my reply to Iain above), but your info may come in quite handy anyway.
Have no fear of perfection - You will never reach it
|
|
|
|
|
I want to create tree in my Dlg.cpp dynamicly, i.e. I did create only Dialog window IDD_DIALOG without tree on it. Then I want to place tree on this window.
I had read MSDN Help & wrote in function OnInitDialog():
CWnd* pPar;
pPar->GetParent();
WINDOWPLACEMENT rc;
pPar->GetWindowPlacement(&rc);
rc.rcNormalPosition.bottom-=10;
rc.rcNormalPosition.left-=10;
rc.rcNormalPosition.right-=10;
rc.rcNormalPosition.top-=10;
pTreectrl->Create(WS_VISIBLE, rc.rcNormalPosition, pPar, 0x1005);
but it does not work - error. What I did incorrect?
Thanks in advance,
bilas.
|
|
|
|
|
WS_CHILD
--
Talk to the hand!
|
|
|
|
|
Remember to initialize the WINDOWPLACEMENT::length member with sizeof(WINDOWPLACEMENT) before calling GetWindowPlacement . Otherwise the function call will fail, and you will not receive the coordinates for rcNormalPosition .
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Did I understand correctly?
CWnd* pPar;
pPar->GetParent();
WINDOWPLACEMENT rc;
//I've added the next string but problem is alive
rc.length = sizeof(WINDOWPLACEMENT);
pPar->GetWindowPlacement(&rc);
rc.rcNormalPosition.bottom-=10;
rc.rcNormalPosition.left-=10;
rc.rcNormalPosition.right-=10;
rc.rcNormalPosition.top-=10;
pTreectrl->Create(WS_VISIBLE, rc.rcNormalPosition, pPar, 0x1005);
I'm beginner, so execuse me if my question is too stupid. But, can you wrote it correctly?
Thanks beforehand, bilas.
|
|
|
|
|
bilas wrote:
pTreectrl->Create(WS_VISIBLE, rc.rcNormalPosition, pPar, 0x1005);
Yes, but you can bitwise OR these styles together to get a combination of properties. e.g.:
m_TreeCtrl.Create(WS_CHILD | WS_VISIBLE | |TVS_HASLINES | TVS_HASBUTTONS, dwStyle, CRect(0,0,1,1), this, IDC_TREE);
I Dream of Absolute Zero
|
|
|
|
|
Ok, I'll post a small code fragment to help you out. Here, we assume that the name of your dialog class is CMyDialog , and that the .cpp file you mentioned contains the implementation of the class.
BOOL OnInitDialog (void)
{
RECT rectParentCA;
this->GetClientRect(&rectParent);<DIV>
rectParentCA.top += 10;
rectParentCA.left += 10;
rectParentCA.right -= 10;
rectParentCA.bottom -= 10;<DIV>
pTreeCtrl->Create( WS_VISIBLE | WS_CHILD | WS_BORDER, rectParentCA, this, 0x1005);
} This will create a tree control, making it a child of the dialog window.
Remember, that although the tree control object/window is automatically destroyed by the framework, the object reserved with new is not. You MUST call delete at the destructor of your dialog.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thanks a lot. It really works! Thank you, men.
|
|
|
|
|
Hello Guys
I need some help regarding VC++, during the Application runtime..how can the get the Application Path ..i.e the Folder path from where the App runs
Thanks in Advance
Hariharan.S.N
|
|
|
|
|
Get the application object with AfxGetApp . The CWinApp::m_pszExeName member contains the path and name of the executable without the .EXE extension.
After getting this string, just manipulate it to remove the application's name (Remove characters until last character before NULL is '\').
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Antti Keskinen wrote:
After getting this string, just manipulate it to remove the application's name (Remove characters until last character before NULL is '\').
Or use _splitpath() .
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|