|
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.
|
|
|
|
|
Hi, I have a passport scanner to scan the passport image to the MFC client application. I was wondering if there is any method to enable the passport image populated on the MFC application could be able to transfer to another c# application an display on a popup window ?I am planning to form up a communication between the c++ and c# application, so that the passport image could be able to process in the c# web application once it was scanned from the MFC application connecting to the passport scanner. Thanks.
|
|
|
|
|
It's just bytes... use one of the many IPC types[^].
Sockets are likely your most commonly used IPC nowadays for a number of reasons, but there's always other options that have different benefits (and drawbacks of course). For example, simply having a shared file would be very simple since you just have to write the file to a shared location and then have a way of notifying the other application of the new file to process (notice can be done via Windows message or other such messaging mechanism, or simply have one application launch the other and load the proper file via command line arguments).
You have a lot of options, you have to decide what's important then implement accordingly. Happy coding!
|
|
|
|
|
I need to create one edit view which could be able to add different color txt automatially(actually by another thread). act like a monitor to monitor the message from serialport or tcp;
The message displayed shall be able have different color to make it has different meanings;(if different font is support is better)
Also when user scrolls up, it could stay at that scroll position, it did not scroll down automatically when new message arrived. User could select and copy the txt;
When user scroll down to the last line, it could scroll down automatically to the last line when background message is arrived; when scrolling, it did not flash(twinkle);
I have tried EditView & Richedit, all failed, the new txt added is by ReplaceSel, which will make the content auto scroll down to the last line, and user could not do Selection and copy when new txt added;
I have found the Visual Studio Trace window, it could add message automatially and user could easily select txt even when new txt added.
I am not sure how to realize it, this thing has bothered me a lot time, please someone could help me about this. Very appricate of your help;
modified 10-Jul-14 3:10am.
|
|
|
|
|
You could try subclassing the EditView so you can have greater control over the movement of text and the actual display. Alternatively you may need to create your own View class which will be specific to your requirements.
|
|
|
|
|
|
Hi,there.
I had a problem that can't solve it and I don't know why.
The problem is that when I sendto one data to one server,then i picked the data through Network Monitor.There is more data than I send.And the source mac is more other than my own pc's mac.
The problem I encountered first time and I don't know why it happened.
Look forward your help.Thank you.
|
|
|
|
|
You need to provide more detail if you want assistance on this.
|
|
|
|
|
|
How to apply the sobel operator to each image and display the edge images
|
|
|
|
|
Sweety08 wrote: How to apply the sobel operator to each image... Just like you would any other filter. Do you have the filter's source code or library?
Sweety08 wrote: ...and display the edge images Are the images on disk or in memory? Are you able to display them as is (i.e., no filter applied)?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
for every pixel, calculate:
Gx =
-1 * p(x-1,y-1) + 1 * p(x+1,y-1) +
-2 * p(x-1,y) + 2 * p(x+1,y) +
-1 * p(x-1,y+1) + 1 * p(x+1,y+1)
Gy =
p(x-1,y-1) + 2 * p(x,y-1) + p(x+1,y-1) -
p(x-1,y+1) - 2 * p(x,y+1) - p(x+1,y+1) +
pOut(x,y) = sqrt(Gx * Gx + Gy * Gy)
(this is from Wiki)
|
|
|
|
|
I need to create an application (PlantModel Application) that needs to run at the background which is invoked by a MFC application which passes command line parameter to the application at the time of invoking.
This model application needs to transfer data across LAN network using TCP sockets and hence needs MFC support. At the same time this model application don't need GUI since it runs at the background only.
Please suggest, What is the best suited application type that can chosen during the creation in Visual studio 2008?
|
|
|
|
|
A simple console application may do it, or probably better, a Windows service.
manoharbalu wrote: transfer data across LAN network using TCP sockets and hence needs MFC support. TCP/IP has no requirement for MFC support.
|
|
|
|
|
My question is: How long must my WSABUF buffers remain valid after calling WSASend while using the WSAEventSelect model?
Background:
Quote: An FD_WRITE network event is recorded when a socket is first connected with a call to the connect, ConnectEx, WSAConnect, WSAConnectByList, or WSAConnectByName function or when a socket is accepted with accept, AcceptEx, or WSAAccept function and then after a send fails with WSAEWOULDBLOCK and buffer space becomes available.
So this means that I can call WSASend successfully until it returns WSAEWOULDBLOCK . But how do I know determinitively when it's OK to delete the buffers that I used in the calls to WSASend ?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
MSDN: The FD_WRITE event is handled slightly differently. An FD_WRITE message is posted when a socket is first connected with connect or WSAConnect (after FD_CONNECT, if also registered) or accepted with accept or WSAAccept, and then after a send operation fails with WSAEWOULDBLOCK and buffer space becomes available. Therefore, an application can assume that sends are possible starting from the first FD_WRITE message and lasting until a send returns WSAEWOULDBLOCK. After such a failure the application will be notified that sends are again possible with an FD_WRITE message.
From this (the last sentence specifically), I'm guessing that you're good to go the upon receipt of the first FD_WRITE after receiving WSAEWOULDBLOCK.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
|
|
|
|