473,398 Members | 2,335 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,398 software developers and data experts.

CreateWindow returns NULL

I am using MSVC .NET to create a C program. I am having trouble creating a
window. The createwindow returns NULL however no error is caught. The
GetLastError() returns "operation completed successfully". So I'm not sure
what the deal is. CreateWindow doesn't have to be called from the main
function does it?
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0, 0,

GetModuleHandle(NULL), NULL, NULL, NULL, NULL,

"TestWindow", NULL };
RegisterClassEx(&wc);
if(NULL==(hWnd = CreateWindow("TestWindow", "Window",

WS_POPUP, 100, 100, 300, 300,

GetDesktopWindow(), NULL,
wc.hInstance, NULL )));

{

FormatMessage(

FORMAT_MESSAGE_ALLOCATE_BUFFER |

FORMAT_MESSAGE_FROM_SYSTEM |

FORMAT_MESSAGE_IGNORE_INSERTS,

NULL,

GetLastError(),

MAKELANGID(LANG_NEUTRAL,
SUBLANG_DEFAULT), // Default language

(LPTSTR) &lpMsgBuf,

0,

NULL);

MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK |
MB_ICONINFORMATION );

LocalFree( lpMsgBuf );

}
Nov 14 '05 #1
2 3392
Jeff Adams <e@mail.com> scribbled the following:
I am using MSVC .NET to create a C program. I am having trouble creating a
window. The createwindow returns NULL however no error is caught. The
GetLastError() returns "operation completed successfully". So I'm not sure
what the deal is. CreateWindow doesn't have to be called from the main
function does it?
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0, 0, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, "TestWindow", NULL };


Your question is about system-specific extensions to C and therefore
off-topic on comp.lang.c. Please ask on
comp.os.ms-windows.programmer.win32.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"We're women. We've got double standards to live up to."
- Ally McBeal
Nov 14 '05 #2
Jeff Adams wrote:
I am using MSVC .NET to create a C program. I am having trouble creating a
window. The createwindow returns NULL however no error is caught. The
GetLastError() returns "operation completed successfully". So I'm not sure
what the deal is. CreateWindow doesn't have to be called from the main
function does it?


<snip>

This is windows specific stuff, so please ask on a Windows group. Here
we only deal with standard C, not system specifics.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Nov 14 '05 #3

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

Similar topics

2
by: Rene van Hoek | last post by:
Hi, I am using Xalan 1.8.0 and Xerces 2.6.0 in C++. I have an XML document which I first transform into an other XML document using an XSL styelsheet. Then I want to parse with XPathEvaluator...
4
by: ezra epstein | last post by:
Aother head banger for me. Below is a complete example of the code Using Postgres 7.4, the function "test" gets this: psql:temp3.sql:10: ERROR: syntax error at or near "%" at character 135...
5
by: VBTricks.de.vu Webmaster | last post by:
Hello, I'm currently trying to port a piece of code from VB6 to VB.net which enables my application to display balloon tooltips. Unfortunately it doesn't seem to work. This is the code VB: ...
10
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaac11/html/acfctNZ_HV05186465.asp "If the value of the variant argument is Null, the Nz function returns the number zero or a...
4
by: Henning M | last post by:
Hej All Im relativ new to VB.net and im trying to collect som device information using cfgmgr32.dll I use - Declare Function GetListLength Lib "cfgmgr32.dll" Alias...
11
by: MLH | last post by:
I have 2 lines in a procedure that assign MyVariant a value - line #238 and line #491. When line #238 runs, the value is 152. When line #491 runs, the DLookup function returns Null. I would expect...
12
by: robertino | last post by:
Hi all, I've put together a few SPs to produce a BOM (bill of materials) listing, which together use a couple of global temp tables, and return the results from a cursor. Here's the code: ...
3
by: gopython | last post by:
Hi all, Python:2.5 OS: Windows XP I have posted couple questions regarding the wxPython. Since I am still a newbie to Python, wxPython makes more sense to me than pyWin for gui programming....
1
by: asilter | last post by:
Hi, I'm trying to assign variables where vpSec0 points. void * vpSec0 = NULL; CreateHVFESection0(vpSec0); CreateHVFESection0 function is below.
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: 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...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.