473,325 Members | 2,870 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,325 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 1116

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) ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.