|
Thank you Richard, deleteing CPrintInfo object is excluded, the destructor is the only place where I explicity delete this object ... I have to dig in ...
|
|
|
|
|
I tried to create a COM component for outlook using article "Building an Office2K COM addin with VC++/ATL". When I register COM, COM added in outlook (display a button in oulook), But If I again open outlook (means 2nd time), COM addin is not there.
What I need to change so that COM functionality should be there untill I unregister the COM component?
|
|
|
|
|
Hi,
I need VC++ code,for copy the particular data from Notepad to another Notepad.
Example, i have lots of data, i need to copy the particular content from Notepad to another Note pad.
Notepad 1:
<Debug: LogRLZ> arg Answer = windows //WINDOWS option will go to excel sheet
<Debug: LogRLZ> arg Answer = patio_doors //patio_doors option will go to excel sheet
<Debug: LogRLZ> arg Answer = entry_doors //entry_doors option will go to excel sheet
Notepad 2_expected Result:
windows
patio_doors
entry_doors
Same kind of datas are available in Notepad.
please provide me the vc++ code.
Thanks
|
|
|
|
|
|
|
Hello Guys.
I have a problem. I have a windows service compiled with various dll's and it includes a project in C++ that contains a reference to Oracle.DataAccess.
The server where that service was installed now has Windows Server 2008 R2 x64. When I try to install the service i get a error in the C++ project. I compiled the project for x64 and now it installs perfectly but when i try to use it i have a BadImage error refering to the Oracle.DataAccess.
I understand that the problem is because the Oracle.DataAccess is x32, but since i can't install oracle x64 in that machine is there anything I can do to make my c++ project run as x64 using the Oracle.DataAccess x32 in the Windows Server x64?
Thanks in advance guys.
|
|
|
|
|
You can NOT mix 32 and 64-bit code in the same process. You either have to recompile your app as 32-bit or install the 64-bit Oracle client.
|
|
|
|
|
Indeed.
I had to install the 64-bit Oracle client.
Now I'm trying to config the application to use 64-bit or 32-bit Oracle client according to the processor type using the configuration in the app.config:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Oracle.DataAccess"
publicKeyToken="89b483f429c47342"
culture="neutral"
processorArchitecture="x86" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Oracle.DataAccess"
publicKeyToken="89b483f429c47342"
culture="neutral"
processorArchitecture="Amd64" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Thanks for your help Dave.
|
|
|
|
|
Hi,
I writing a small application which will notify whenever any windows messages or Dialogue boxes appear with any of the (Error,Information,Warning,Question) Icons.
this is how i am doing..
main()
{
WinHAn = FindWindowA(NULL,"Windows Security");
if(WinHAn != NULL)
{
EnumChildWindows(WinHAn,SearchIcon,(LPARAM) &winIconSearch);
}
}
static BOOL CALLBACK SearchIcon(HWND hwnd, LPARAM lParam)
{
style = GetWindowLongPtr(hwnd, GWL_STYLE);
if ((style & SS_ICON) == SS_ICON)
{
thisHan =(UINT64)SendMessageW(hwnd, STM_GETIMAGE,IMAGE_ICON, 0L);
searchHan =(UINT64) LoadIconA(NULL, (LPCSTR)(IDI_WARNING));
if(thisHan ==searchHan )
{
printf("Icon Found");
}
return TRUE;
}
This is only for Warning messages.But it is not working. can any body tell me what the problem is..
Thanks.
vvk.
|
|
|
|
|
You might add some more output to your program to see which code is reached or use the debugger for the same purpose. E.g. if a window with the title "Windows Security" is found and if such a window contains a static control with an icon.
Your check for SS_ICON is wrong (but this is not the reason for finding nothing). You should use:
if ((style & SS_TYPEMASK) == SS_ICON)
Finally I'm not sure if this can be done this way. While the LoadIcon description states that it may return a handle to an existing resource, this may be only true when the icon has been loaded by the same application.
|
|
|
|
|
Stepping through your code with the debugger will identify where it is failing. Have you checked that there is a currently open Window with the title "Windows Security", to satisfy the FindWindowA call? By the way, it is really bad practice to use the A or W suffixes on your Windows API calls. Use the project settings to set your project to ASCII or Unicode mode, and let the compiler generate the appropriate code.
|
|
|
|
|
Hi,
i have tried with debugging and the it is failing at the if condition if(thisHan ==searchHan).Sendmessage function('thisHan') is returnig one value and where Loadicon function is returning('searchHan') different value.
|
|
|
|
|
So the icons don't match. All that tells you is that the icon for the message window is not the one you were hoping for. The chances of you being able to use this code in a production environment are not very high, since very few applications will be doing things the way you expect or want.
|
|
|
|
|
Hi,
My application menu items which are created dynamically. When window DPI settings gets changed and set to 'Larger (150%)', menu item text is not visible as it is very big and hiding behind the toolbar.
How can we set menu item font size or complete menu pane itself using VC++ by code so that it will be visible in all the DPI settings?
Regards,
Aniket
|
|
|
|
|
Have you looked at the GetMenuBarInfo function? You can get the RECT of the menu-bar with this function.
I.e
MENUBARINFO mbi;
mbi.cbSize = sizeof(mbi);
GetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
printf("menuBar rect (screen) = %d,%d,%d,%d\n", mbi.rcBar.left, mbi.rcBar.top, mbi.rcBar.right, mbi.rcBar.bottom);
MapWindowPoints(HWND_DESKTOP, hwnd, (LPPOINT)&mbi.rcBar, 2);
printf("menuBar rect (client) = %d,%d,%d,%d\n", mbi.rcBar.left, mbi.rcBar.top, mbi.rcBar.right, mbi.rcBar.bottom);
Notes:
1. All of the members are 0 during the WM_CREATE message handler
2. The dimensions returned are in screen-coords.
Example output:
menuBar rect (screen) = 108,130,636,149
menuBar rect (client) = 0,-20,528,-1
When I tried to change the DPI setting with the program running, I was told I'd have to logoff and then login again. Am I correct in assuming that you change the DPI and _then_ open the program?
Also, is this a standard menubar, or is it an instance of a toolbar that's been added to a rebar control? The difference being that a standard one should be a part of the non-client area, and therefore the toolbar you have should be automatically moved down to accomodate the menubar having larger text.
If however, you have a toolbar inside a rebar control as your menu, the rebar container is a part of your client area, and you need to manually position the toolbar below it. Different DPI settings will change the required height that you need to offset the toolbar by.
Can you upload a screen shot somewhere and post a link to it?
|
|
|
|
|
Hi,
i have developed an application in which i have icons in left side pane of application which can be dragged and dropped in client screen. Application is working fine with all the resolution except 1920x1080.
when setting the resolution to 1920x1080 while dragging icons to client area, icon is not attach to mouse pointer. instead there is a gap between the mouse pointer and the icon. i wrote code to identify the screen resolution but it does not seem to recognize 1920x1080 resolution. below code is giving incorrect resolution for 1920x1080 setting.
RECT actualDesktop;
GetClientRect(GetDesktopWindow(),&actualDesktop);
value of 'actualDesktop' variable is {top=0 bottom=783 left=0 right=1536} which is incorrect. according to current resolution size value should be {top=0 bottom=1080 left=0 right=1920}. Due to this, all the icons while dragging are adjusting according to incorrect resolution setting.
Can someone help me to identify the issue and let me know if there is any limitation with respect to screen resolution in VC++ 6.0 with windows 8 environment.
If require i will place more detailed code about the drag and drop functionality.
Regards,
Aniket
|
|
|
|
|
Member 3778954 wrote: VC++ 6.0 with windows 8 environment. That may well be your problem; VC 6 is very old and probably has many issues with Windows 8. I strongly suggest you upgrade to the latest version of Visual Studio.
|
|
|
|
|
Hi,
Thanks for replying.
But i am getting same issue when compiling in VS2012 in windows 8. code does not seem to recognize 1920x1080 resolution setting and downgrading my application look and feel by setting it to lower resolution.
Any help would be appreciated.
Regards,
Aniket
|
|
|
|
|
I would suggest that using GetClientRect is not the best way to get screen size as this may well take into account reserved areas on the desktop. You could try GetWindowRect instead, or better still use GetSystemMetrics with the SM_CXSCREEN and SM_CYSCREEN parameters, to get the physical dimensions.
|
|
|
|
|
Thanks Richard,
I was finally able to make my application DPI aware in VC6.0. Now i am able to get the correct resolution settings of my machine.
However another issue started after making these changes. Since the application is now recognizing the screen resolution and adjusting all child window according to that but the menu bar text seem not to be adjust at all automatically.
The text size of menu item is large and hiding behind the toolbar. How can i programmatically change menu bar text size?
Kindly suggest any solution.
Regards,
Aniket
|
|
|
|
|
Member 3778954 wrote: I was finally able to make my application DPI aware in VC6.0. Please tell us the solution so other people may benefit.
Member 3778954 wrote: The text size of menu item is large and hiding behind the toolbar. Without seeing some code it's impossible to guess why.
|
|
|
|
|
Hi Richard,
I have added below lines of code in my App class init function to make the application aware of DPI settings.
HMODULE hUser32 = LoadLibrary(_T("user32.dll"));
typedef BOOL (*SetProcessDPIAwareFunc)();
SetProcessDPIAwareFunc setDPIAware = (SetProcessDPIAwareFunc)GetProcAddress(hUser32, "SetProcessDPIAware");
if (setDPIAware)
setDPIAware();
FreeLibrary(hUser32);
User32.dll library is present in "System" folder of windows directory.
After adding the above code, my application is now scaling according to DPI settings but menu items font size is increased too much so that it is hiding behind the toolbar.
Menu bar is created by default as it is created in a MDI application.
if(!m_wndMenuBar.Create(this))
{
TRACE0("Failed to create menubar\n");
return -1;
}
When application get scaled automatically based on DPI settings (Larger 150%), menu bar text become large and hide behind the toolbar.
Any help would be appreciated.
Regards,
Aniket
|
|
|
|
|
Why are you using LoadLibrary to get access to user32.dll when it is automatically linked in to just about every Win32 program ever written? Just make the direct call to SetProcessDPIAware , or better still do what is suggested at http://msdn.microsoft.com/en-gb/library/windows/desktop/ms633543(v=vs.85).aspx[^].
As to your menu issue I have no idea I'm afraid, the code you have shown above merely shows how a menu is created. It would also help if you used indentation and put <pre> tags around your code so it is easier to read, like:
if(!m_wndMenuBar.Create(this))
{
TRACE0("Failed to create menubar\n");
return -1;
}
Use the code button above the edit box.
|
|
|
|
|
Hi Richard,
I need to load User32.dll because in VC6.0 this library is not linked automatically and to make my application DPI aware, i have to load it manually.
As far as menu bar is concern, i found one strange thing. If i set my DPI settings to 'Large' (150%) or higher and open my application then at first menu is hiding behind the toolbar as the text of item big. But once I change my system text size (COntrol panel -> display -> change on the text size options) to any size and windows is refreshed and then my application menu become proper.
My doubt is that application is scaling child window and main window but not the menu item when opened first but when system text size is changed and windows is refreshed then application is also scaling all the text size according to system settings.
How can i make my application set all the text including menu according to system text settings in the first place.
Regards,
Aniket
|
|
|
|
|
Sorry, I don't know the answer. I can only suggest you try some further searching, or maybe one of the Microsoft forums.
|
|
|
|