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

C and WinAPI: hwnd question

131 128KB
I've started working on win32 programming, and have a question regarding hwnds. I've milled over tutorials and they seem to vary - I've tried using the following 3 methods, but was wondering which, if any, is preferred?


Expand|Select|Wrap|Line Numbers
  1. ...
  2. static HWND hwnd1 = 0;
  3. ...
  4. WM_CREATE :
  5.     hwnd1 = CreateWindow(...);
  6. ...
  7.  
Expand|Select|Wrap|Line Numbers
  1. HWND function(...)
  2. {    
  3.     return CreateWindow(...);
  4. }
  5.  
Expand|Select|Wrap|Line Numbers
  1. #define IDC_CONTROL 1001
  2. ...
  3. WM_CREATE :
  4.     CreateWindow(..., IDC_CONTROL, ...);
  5. ...
  6.  
  7. SendMessage(GetDlgItem(hwnd_parent, IDC_CONTROL), ...);
  8.  
TIA
Sep 27 '14 #1
0 1119

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Newsgroup | last post by:
I have a multiline textbox with 10 lines of text in it. I want to search Line by Line for the word" ". How do I process one line in a text box at a time? I DON'T want to just search the whole...
11
by: enki | last post by:
I am writing a game and I am having trouble with moving the character on the map. Here is what I have right now. It involves win32 programming but that not my problem. I would like some...
2
by: bellparis | last post by:
I'm a student who tries to use EliCZ's hooking library, AE5.6. My ultimate purpose which I try to use EliCZ's library is preventing users from copying data by windows clipboard. So I Added...
1
by: amit bharadwaj | last post by:
hi am using panel with autoscroll , now i want to call window api BOOL GetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi)); now am doing like tht unsafe public static extern bool...
4
by: mark | last post by:
I need to use GetDC but I don't know how to find a parameter to pas to the function. This is the GetDc from MSVC help: ********** GetDC The GetDC function retrieves a handle to a display...
5
by: Michel | last post by:
Hi, I tried to use Winapi floodfill function with an Access Form. Here is the code in a click-button sub : Dim hDC As Long Dim hBrush As Long Dim hobj As Long Dim ret As Long
15
by: =?Utf-8?B?Sm9hY2hpbQ==?= | last post by:
How can I pass a C++ HWND to and from C# and Managed C++?
14
by: JoeC | last post by:
I have been writing games and I also read about good programming techniques. I tend to create large objects that do lots of things. A good example I have is a unit object. The object controls...
2
by: Dave King | last post by:
Hi All- I'm trying to customize this project ( http://www.codeproject.com/shell/IEMenuButton.asp ) and I'm getting an access voilation and was hoping somebody would be able to give me some idea...
2
by: B | last post by:
Hey I found some (VERY) old C++ code of mine that recursively built a tree of the desktop window handles (on windows) using: (they are stored in an STL vector) void FWL(HWND hwnd, int nFlag) ...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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.