473,385 Members | 1,707 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,385 software developers and data experts.

Display issues -- Randy Birch

Randy:

Hope you get this. I am the one that wrote regarding trying to get my boss'
computer screen to fit my program (rather than the other way around).
Thanks for the hint.

I went to the link provided for enumeration of the display. I tried the
program in VB6.0 and it worked (while I had it as a stand alone). I
modified it so that the Public Declare statements and variables were in a
Bas Module. Then I put the procedure to find out what the start up display
is in the MDI form of a program. It worked.. I put it the same way in my
program and it did not work. It keeps stopping and telling me that the
"hDC" is an undefined variable. Yet, "hDC" is part of the Public Declare in
the Module.

Do you have any idea why this is happening? I've gone to the vb site with
the script on it and left a question, but still have had no response.

Hope you find this and have a suggestion.

Thanks
JP
Apr 22 '06 #1
2 3929

"Joe-Paul" <Ha*********@comcast.net> wrote in message
news:bf********************@comcast.com...
Randy:

Hope you get this. I am the one that wrote regarding trying to get my boss' computer screen to fit my program (rather than the other way around).
Thanks for the hint.

I went to the link provided for enumeration of the display. I tried the
program in VB6.0 and it worked (while I had it as a stand alone). I
modified it so that the Public Declare statements and variables were in a
Bas Module. Then I put the procedure to find out what the start up display is in the MDI form of a program. It worked.. I put it the same way in my
program and it did not work. It keeps stopping and telling me that the
"hDC" is an undefined variable. Yet, "hDC" is part of the Public Declare in the Module.

Do you have any idea why this is happening? I've gone to the vb site with
the script on it and left a question, but still have had no response.

Hope you find this and have a suggestion.

Thanks
JP

Make sure you don't have a control, procedure, or function named hDC
Apr 23 '06 #2
I was on holiday - you did (finally) get my reply, and glad to hear that it
worked out.

For the others, here's the gist of the reply:

In the absence of a local variable declared named hdc, the use of hdc in
form code is the same as me.hdc, or the hdc of the form (hdc means 'handle
to the display context'). Since in that demo hdc is not a defined variable,
it was anticipated the code would be used in a form that exposed its hdc
property.

The problem is that an MDI form, which does not natively allow drawing on
its container, does not expose the hdc of the form . So if you're going to
put the code in the MDI parent form, you'll need to declare a variable in
the procedure Dim hdc as Long, and then use the GetDc() and
GetDesktopWindow() APIs to obtain an hdc you can use. In air code, like:

Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
dim hdc as long

hdc = GetDC(GetDesktopWindow())

..... now use the hdc value with the code for GetDeviceCaps.

--

Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/

Please reply to the newsgroups so all can participate.


"Joe-Paul" <Ha*********@comcast.net> wrote in message
news:bf********************@comcast.com...
Randy:

Hope you get this. I am the one that wrote regarding trying to get my boss'
computer screen to fit my program (rather than the other way around).
Thanks for the hint.

I went to the link provided for enumeration of the display. I tried the
program in VB6.0 and it worked (while I had it as a stand alone). I
modified it so that the Public Declare statements and variables were in a
Bas Module. Then I put the procedure to find out what the start up display
is in the MDI form of a program. It worked.. I put it the same way in my
program and it did not work. It keeps stopping and telling me that the
"hDC" is an undefined variable. Yet, "hDC" is part of the Public Declare in
the Module.

Do you have any idea why this is happening? I've gone to the vb site with
the script on it and left a question, but still have had no response.

Hope you find this and have a suggestion.

Thanks
JP
Apr 25 '06 #3

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

Similar topics

6
by: Visual Boodu .NET | last post by:
If you read this mate, your site has saved my life and you are a legend.
6
by: tony wong | last post by:
i wish to count number of characters in textarea box during typing in and display it somewhere in html page. so the number will increase during writing. is it possible to do it by javascript? ...
17
by: MLH | last post by:
Can I control what text appears on msgbox function buttons? Sure do like NOT having to build a form to show a msg and solicit a YES/NO response. MsgBox function is a great solution for that. ...
4
by: DoomedLung | last post by:
I have been developing an image gallery which needed to be dynamic as possible. so I have placed the gallery in a div plus a div containing the large image to be displayed. It works by changing...
5
by: Joe-Paul | last post by:
Is there a way to get the desktop (computer's) display settings (the size of the window; i.e. 1024 X 768, etc.) when starting a program...changing it to what it needs to be for the length of the...
11
by: Ron L | last post by:
I have a barcode scanner which uses a "keyboard wedge" program so that the data it scans comes through as if it was typed on a keyboard. I am trying to have the data in the barcode be displayed in...
7
by: Janis | last post by:
I try to understand what could be the source of a problem with displaying and hiding rows of tables using display:block/none. I've read selfhtml but could not find any hint about that. Any...
3
by: Chandra | last post by:
Hi All, I have 2 htmls with one being referred in iframe of the other. The iframe html has style display = block and none set in the javascript. however this makes the block go behind the parent...
2
by: Randy | last post by:
Hi, I have a small table - 2 columns, 5 rows. Col 1 is the key column and has integer values of 1 through 5. Column 2 is a varbinary(MAX) column and has jpg images loaded in it. What I want...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.