|
Hello
Does anyone know how i can use "FOR XML" expilicit command with ODBC in Visual C++ 6.0?
thx
-- modified at 20:39 Saturday 4th November, 2006
|
|
|
|
|
I'm asking this question because i tried many times to find a way to change connection parameters such as times out , number of retries , login , password every thing when the user intend to do so when i found a function called RASdialup() and other functions and by filling the RASDIALPARAMS sructure and after the excution of prog finally and unfortunatly i found RAS dial up not useful since the adsl modem has been used, after i decided to look back to WININET library .. another problem found is we can only change the 'PROXY' authentication :
//hOpen is the HINTERNET handle created by Internet Open
//strUsername is a string buffer that contains the proxy username
InternetSetOption(hOpen, INTERNET_OPTION_PROXY_USERNAME,
strUsername, strlen(strUsername)+1);
//strPassword is the buffer that contains the proxy password
InternetSetOption(hOpen, INTERNET_OPTION_PROXY_PASSWORD,
strPassword, strlen(strPassword)+1);
the second flag|parameter INTERNET_OPTION_PROXY_USERNAME can be changed only to INTERNET_OPTION_USERNAME but WITH condition calling InternetConnect function and return a handle hConnect, (for my point of view i want the first flag to be NULL to indicate that we can change the DEFAULT SETTINGS).
Note that there is a way to use INTERNET_OPTION_PER_CONNECTION_OPTION as a customized option the default settings changed well and we can use LAN connection options but without authentications change!! :
BOOL SetConnectionOptions()
{
INTERNET_PER_CONN_OPTION_LIST list;
BOOL bReturn;
DWORD dwBufSize = sizeof(list);
// fill out list struct
list.dwSize = sizeof(list);
// NULL == LAN, otherwise connectoid name
list.pszConnection = NULL;
// set three options
list.dwOptionCount = 3;
list.pOptions = new INTERNET_PER_CONN_OPTION[3];
// make sure the memory was allocated
if(NULL == list.pOptions)
{
//return FALSE if the memory wasn't allocated
return FALSE;
}
// set flags
list.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
list.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT | PROXY_TYPE_PROXY;
// set proxy name
list.pOptions[1].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
list.pOptions[1].Value.pszValue = "http://proxy:80";
// set proxy override
list.pOptions[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
list.pOptions[2].Value.pszValue = "local";
// set the options on the connection
bReturn = InternetSetOption(NULL,
INTERNET_OPTION_PER_CONNECTION_OPTION, &list, dwBufSize);
//free the allocated memory
delete [] list.pOptions;
return bReturn;
}
If still not understand ignore it and help for how to change all default connection settings with any type of connection (LAN/ADSL/PHONE DIAL UP) ... I am really stuck
Anyone who considers arithmetical methods of producing random numbers is, of course, in a state of sin.
John von Neumann
|
|
|
|
|
I've seen some application that customise buttons on the title bar of a window. There are tutorials on CodeProject about this. My question is, although I can customise a button on my own application title bar, is there a way I can do this globally for all windows? I want to write an extension to add a button/function to every window/application.
Can anyone point me in the right direction of where to begin and any decent reference material?
http://www.asura.co.uk
|
|
|
|
|
The buttons on a title bar are not actually buttons, they are just regions in which you can click. To install a global button you would have to globaly hook the WM_NCPAINT then calculate the position for each window. I can't imagine it being too difficult, but you would have to take into account the window style for each window.
|
|
|
|
|
Thanks for the info.
I assume my application needs to be a 'shell extension' COM object as I want my application to be integrate into all visible windows/applications without manually running anything. I'm new to that area of programming and from what I gather there is very little documentation (either that or I'm not using the right search keywords )
... can anyone offer any advice?
http://www.asura.co.uk
|
|
|
|
|
http://img115.imageshack.us/img115/2114/erroruq1.jpg[^] what is wrong with my aplication? when it runs on my pc everything is alright but when i try to run it on others PC's it gives an error like that above.
I am running on Windows XP SP2 while others i think on Windows XP no SP or SP1... but there is no difference between sp1 and sp2 at least for applications running, i think...
any ideas how to fix that? maybe compilator settings are wrong?
thank you in advance for help
|
|
|
|
|
Are you using manifest files? I had a similar problem some time ago when using them.
This[^] may be of some help to you.
|
|
|
|
|
|
if found that i need to install somewhat dll package to another PC... but thats useless at least in my case. I need standalone executable like Skype.exe and it doesn't matter how big it would be...
i didn't found anything useful about how to make standalone application. I have linked ATL libraries staticaly but thats not enought...
so how to make my application standalone?
|
|
|
|
|
you didn't answer my question. If you are using a manifest file, then you are forced to include the correct version of the dll's with your app. Try disabling the manifest.
|
|
|
|
|
ohh.. sorry if i disable the manifest then my application doesn't find MSVCR80D.dll
|
|
|
|
|
edvintas wrote: ...MSVCR80D.dll
There's the problem.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
edvintas wrote: I need standalone executable like Skype.exe and it doesn't matter how big it would be...
You'll need to staticly link to the CRT, to avoid having to redistribute the CRT DLLs with your app.
|
|
|
|
|
wow, it works
it is alive! :->
thanks... for advice
|
|
|
|
|
How can I get the keys of HKEY_CURRENT_USER? Are there any APIs?
Thank you?
modified 8-Mar-17 3:51am.
|
|
|
|
|
can you be a little more specific? You want to get a list of all the keys under HKEY_CURRENT_USER? Use the RegEnumKeyEx() in a loop increasing the dwIndex value each time. But make sure you do not make any changes to the registry within your loop. If you want to change any values, either store the key and do it after your loop, or break out then start looping again from the beginning.
|
|
|
|
|
|
I'm trying to implement a child window anchoring system into my window. My code works all well and good right up until the child window is resized to a point where it becomes invisible. This is the basic code I am using to calculate the new positions
::GetWindowRect(m_hWnd,&rcNew);
::OffsetRect(&rcNew,-rcNew.left,-rcNew.top);
::CopyRect(&rcOld,&m_rcWindow);
::OffsetRect(&rcOld,-rcOld.left,-rcOld.top);
int Xoffset = rcNew.right - rcOld.right;
int Yoffset = rcNew.bottom - rcOld.bottom; The value of rcNew is later stored.
Now heres the problem. For all child controls of the main window, it works. The new rectangle may contain negative figures which is no problem since it corrects itself when the window is again resized. But for the children of children an incorrect value is being assigned to the Xoffset and Yoffset values. I have traced this to the GetWindowRect() call. If a window is told to resize to a negative figure, it actually resizes to 0. Therefore GetWindowRect() returns a 0 width or 0 height. To do this correctly I need to somehow find the window rect as if it were inverted, ie a begative figure for the width or height. Any suggestions?
|
|
|
|
|
Not sure exactly how you're implementing your anchoring, but GetWindowRect get's the coordinates in screen coordinates, but the moving/sizing functions (MoveWindow, SetWindowPos, etc) work in client coordinates.
You can use ClientToScreen and ScreenToClient functions to translate between the two. If you move a parent window, the children will move also, since they're relative to the parent, so you shouldn't need to move the children of the children (but you will need to resize them).
This code will leave the child control at it's current x, y position, but adjust the child width based on the parent width:
::GetClientRect(m_hParentWnd, &rcParent);
::GetClientRect(m_hChildWnd, &rcChild);<br />
<br />
rcChild.right = rcParent.right - ( rcParent.right - rcChild.right );<br />
<br />
::MoveWindow( m_hChildWnd, rcChild.left, rcChild.top, rcChild.right - rcChild.left, rcChild.bottom - rcChild.top, TRUE );<br />
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Thanks for the reply but the code sample I gave is correct for what I am trying to do. I am specificaly using GetWindowRect() do to the extent of which I have customised the windows. GetClientRect() will no longer give a true reading. Also from my code you should see that I simply calculate the Xoffset and Yoffset then add or subtract this to the childs stored rectangle.
Since I posted the question I have managed to solve it. The first call to my function always comes from the main window, So I can pass in a NULL LPRECT forcing the function to call the GetWindowRect() api. Since this then calculates the new childrens position I can recurse the function passing in the newly calculated childs rectangle. This gives the added advantage of only needing to call the function once from the main window.
|
|
|
|
|
Glad you got it figured out!
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Hi,
I use dynamically created menus in my application where menu management becomes a complex task.
My problem is that when I get a CMenu pointer (CMenu* pMenu), how can I get the text and ID of the menu pointed by pMenu??
All menu APIs I saw so far deal with child menus, is there a way to get these information using this pointer?? My menu is a popup menu.
Thanks,
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
The CMenu::GetMenuItemID() and CMenu::GetMenuString() methods should help.
What exactly are you trying to obtain with the CMenu pointer?
Mark
|
|
|
|
|
those method did not help. what I am trying to do is as follows:
I use OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu) msg handler to update the childs of a popup menu item before they are displayed.
I need to know what menu item is exactly being updated, so I want either its ID or its text.
The methods you have posted are declared as follows:
UINT GetMenuItemID(int nPos )const;
int GetMenuString( UINT nIDItem, LPTSTR lpString, int nMaxCount, UINT nFlags ) const;
those deal with the childs of a popup menu item, not the menu item itself.
Any Ideas??
Thanks alot
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
The 1st level of the popup (the items you see first when it pops up) is pMenu->GetSubMenu(0).
So the top level items can be accessed like this:
pMenu->GetSubMenu(0)->GetMenuString(...)
If the third item (index 2) has a sub menu you could get at it like this:
pMenu->GetSubMenu(0)->GetSubMenu(2)->GetMenuString(...)
|
|
|
|