473,405 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

window jumps around

Is there any reason why you shouldn't use CreateWindow in a DLL?
I've got an application that calls a function in a custom DLL from its
wndproc. In the DLL, I am creating a window using CreateWindow with
WS_POPUPWINDOW | WS_CAPTION | WS_CHILD, and displaying it modally (i.e.
executing a message pump in the DLL's function).
This works almost fine, i.e. the window displays and closes again and is
like a child popup window should be, but the window does 'jump around' a
bit, i.e. when you try to select the background (main app's) window, then
click on the caption of the child window, it does a little hop to another
area of the screen. Not far, but it's definitely more than the negligible
amount of dragging associated with the clicking. The DLL only registers its
wndclassex on the first call to it, after that, it just uses the same one. I
am also calling DestroyWindow on the child window before exiting the DLL
function.
I did rethink about the design of the app and decided that using
CreateDialog with a dialog resource might be better. (Also to that, is there
any reference on the commands used in the .rc file for the dialog resource?)
But I'm hesitant to, for fear the same thing may happen if I don't know
what's causing it, whereas if I can isolate the problem I can make sure it's
not due to the fact that it's in a DLL.

Thanks
Nov 17 '05 #1
3 961
Bonj wrote:
Is there any reason why you shouldn't use CreateWindow in a DLL?
I've got an application that calls a function in a custom DLL from its
wndproc. In the DLL, I am creating a window using CreateWindow with
WS_POPUPWINDOW | WS_CAPTION | WS_CHILD, and displaying it modally (i.e.
executing a message pump in the DLL's function).
This works almost fine, i.e. the window displays and closes again and is
like a child popup window should be, but the window does 'jump around' a
bit, i.e. when you try to select the background (main app's) window, then
click on the caption of the child window, it does a little hop to another
area of the screen. Not far, but it's definitely more than the negligible
amount of dragging associated with the clicking. The DLL only registers its
wndclassex on the first call to it, after that, it just uses the same one. I
am also calling DestroyWindow on the child window before exiting the DLL
function.

CreateWindow is just fine in a DLL. Perhaps you have other code in your
DLL that responds to WM_SIZE or WM_MOVE that is confusing client
coordinates with window coordinates?

/steveA
--
Steve Alpert
my email Fgrir_Nycreg @ vqk.pbz is encrypted with ROT13 (www.rot13.org)
and spaces

Nov 17 '05 #2
nope, no other messages are handled, other than WM_CLOSE.

"Steve Alpert" wrote:
Bonj wrote:
Is there any reason why you shouldn't use CreateWindow in a DLL?
I've got an application that calls a function in a custom DLL from its
wndproc. In the DLL, I am creating a window using CreateWindow with
WS_POPUPWINDOW | WS_CAPTION | WS_CHILD, and displaying it modally (i.e.
executing a message pump in the DLL's function).
This works almost fine, i.e. the window displays and closes again and is
like a child popup window should be, but the window does 'jump around' a
bit, i.e. when you try to select the background (main app's) window, then
click on the caption of the child window, it does a little hop to another
area of the screen. Not far, but it's definitely more than the negligible
amount of dragging associated with the clicking. The DLL only registers its
wndclassex on the first call to it, after that, it just uses the same one. I
am also calling DestroyWindow on the child window before exiting the DLL
function.

CreateWindow is just fine in a DLL. Perhaps you have other code in your
DLL that responds to WM_SIZE or WM_MOVE that is confusing client
coordinates with window coordinates?

/steveA
--
Steve Alpert
my email Fgrir_Nycreg @ vqk.pbz is encrypted with ROT13 (www.rot13.org)
and spaces

Nov 17 '05 #3
Bonj wrote:
Is there any reason why you shouldn't use CreateWindow in a DLL?
I've got an application that calls a function in a custom DLL from its
wndproc. In the DLL, I am creating a window using CreateWindow with
WS_POPUPWINDOW | WS_CAPTION | WS_CHILD, and displaying it modally (i.e.
executing a message pump in the DLL's function).
This works almost fine, i.e. the window displays and closes again and is
like a child popup window should be, but the window does 'jump around' a
bit, i.e. when you try to select the background (main app's) window, then
click on the caption of the child window, it does a little hop to another
area of the screen. Not far, but it's definitely more than the negligible
amount of dragging associated with the clicking. The DLL only registers its
wndclassex on the first call to it, after that, it just uses the same one. I
am also calling DestroyWindow on the child window before exiting the DLL
function.
I did rethink about the design of the app and decided that using
CreateDialog with a dialog resource might be better. (Also to that, is there
any reference on the commands used in the .rc file for the dialog resource?)
But I'm hesitant to, for fear the same thing may happen if I don't know
what's causing it, whereas if I can isolate the problem I can make sure it's
not due to the fact that it's in a DLL.

Thanks

A window can't have both WS_POPUP and WS_CHILD styles.

You probably want only WS_POPUP since you have also specified WS_CAPTION.

Norm

--
--
To reply, change domain to an adult feline.

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jamie Jackson | last post by:
I'm using showModalDialog() to popup a window with some long text, followed by a couple of form elements. The content of the popup scrolls, since the content is longer to than the window. However,...
3
by: Daniel Goldman | last post by:
When I open a new popup window, with a url that includes an anchor, about 1/5 of the time the page displays correctly (jumps to anchor), 4/5 of the time page displays incorrectly (starts from...
20
by: Mandy Memphis | last post by:
If I perform a mousedown within a document, move the mouse outside the browser window, and then release the mouse button, the document.onmouseup event does not fire. Is there any way to detect a...
4
by: Raffi | last post by:
I need to do the following: From the main page I click a link button and open a javascript popup window. So far so good. Now when i try to open a new popup window from a button link in the first...
2
by: David Otton | last post by:
Hi, I'm seeing a difference in behaviour between window.onload = f(); and <body onload="f();"> Specifically, window.onload appears to fire before all the elements of the page have been...
2
by: Gordon Airporte | last post by:
I'm trying to get my canvas to resize to fill its frame within a window, but I can't figure out how to handle the callback data from the window's <Configure> properly. It has very strange behavior...
11
by: David Schwartz | last post by:
When I run my VB.NET Windows Forms application, the CPU usage jumps up to 100%. If I drop-down a menu, the usage goes down to a more reasonable number, like 0-2%. The same is true when a MsgBox...
10
by: morangolds | last post by:
Hi, I've been having a problem with C++ Windows Forms apps not "ending" when you close the form window. I've searched about this problem all over the place and most searches have lead me to...
1
by: John Walker | last post by:
"Ctrl + Up/Down arrows: Helps you move between procedures/functions in the code window" ..... this works in vb6, does anybody know if there's something similar in vb.net? Thanks, John
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.