473,788 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Command Line compiling API and MFC programs

How does not compile a Windows API and a Windows MFC program from the
command line with Visual.net. (I can do the former, at least, with Visual
Studio by creating a "Win32 Project.")

However, I tried the same thing on the command line.
(In the days of Visual C++ 4.0 through Visual C++ 6.0, I had some
make files and stuff that did this.

So, I typed CL hellowin.C

There were no compile time erors; only errors from the linker
such as error LNK2019: unreasolved external symbol
___imp__Dispatc hMessageA4

I got similar errors from other basic Windows API functions such
as Show Window, DrawText and BeginPaint.

So I believe that I need to know what libraries are needed and how to
specify these. The "CL" command does not accept the "/LIBRARY" option
from Visual C++ 4.0

Thanks for any help that can be provided.
Dr. Laurence Leff Western Illinois University, Macomb IL 61455 ||(309) 298-1315
Stipes 447 Assoc. Prof. of Computer Sci. Pager: 309-367-0787 FAX: 309-298-2302
Secretary: eContracts Technical Committee OASIS Legal XML Member Section

Here is the helowin.c file:
#include "c:\progra~1\mi cros~1.net\Vc7\ PlatformSDK\Inc lude\Windows.h"
#include "stdio.h"

int count;
HINSTANCE ghInstance;

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int iCmdShow)

{
HWND hWnd;
MSG msg;
WNDCLASSEX wndclass;
static char szAppName[] = "HelloWin";
ghInstance = hInstance;

wndclass.cbSize = sizeof (wndclass);
wndclass.style= CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWn dProc = WndProc;
wndclass.cbClsE xtra = 0;
wndclass.cbWndE xtra = 0;
wndclass.hInsta nce = hInstance;
wndclass.hIcon = LoadIcon (hInstance,IDI_ APPLICATION);
wndclass.hCurso r = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBac kground = (HBRUSH) GetStockObject (WHITE_BRUSH);
wndclass.lpszMe nuName =NULL;
wndclass.lpszCl assName =szAppName;
wndclass.hIconS m = LoadIcon (NULL,IDI_APPLI CATION);

RegisterClassEx (&wndclass);

hWnd = CreateWindow (
szAppName,
"The Hello Program",
WS_OVERLAPPEDWI NDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);

ShowWindow (hWnd, iCmdShow);
UpdateWindow (hWnd);
while (GetMessage(&ms g,NULL,0,0))
{
TranslateMessag e(&msg);
DispatchMessage (&msg);
}
return msg.wParam;

}

LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)
{
HDC hDC;
PAINTSTRUCT ps;
RECT rect;
char str[100];
switch (iMessage)
{
case WM_CREATE:
return 0;
count = 0;
case WM_PAINT:
hDC = BeginPaint (hWnd, &ps);
GetClientRect (hWnd,&rect);
sprintf(str,"%d ",count);
DrawText (hDC, str, -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER);
EndPaint (hWnd, &ps);
return 0;
case WM_LBUTTONDOWN:
count++;
InvalidateRect( hWnd,NULL,TRUE) ;
return 0;
case WM_DESTROY:
PostQuitMessage (0);
break;
default:
return DefWindowProc (hWnd, iMessage, wParam, lParam);
}
return (0L);
}
Nov 14 '05 #1
2 2659
Dr. Laurence Leff wrote:
[snip]
So I believe that I need to know what libraries are

[snip]

Yes. You have to tell the compiler the libraries you need.

If you read your compiler documentation, you will find the
name.

It is better when starting, to use the IDE provided by Microsoft
because it gives access to the documentation. For each function
the doc tells you which library is needed.

Besides, it shields the novice programmer from many complexities.

Load your program in the editor, and type F1 at the name
you want to investigate. Then, if the installation went OK,
the help system will display you the doc of that function.

I would ask further questions in the many support groups of the
compiler in the net.

jacob

Nov 14 '05 #2
Dr. Laurence Leff wrote:
How does not compile a Windows API and a Windows MFC program from the
command line with Visual.net. (I can do the former, at least, with Visual
Studio by creating a "Win32 Project.")


<snip>

This is all very Windows MSVC specific and thus off topic in
comp.lang.c, it belongs somewhere in one of the MS specific news groups.
--
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

7
6037
by: Ken Innes | last post by:
I am trying to write a little program that can be run as a Windows program or as a command line program. I'm really not sure the best way to do this, so what I came up with so far was to check for command line parameters (code shown below). This works, except that printf()'s don't display anything. Is there a better way to do this? WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int pszCmdLine) { if(ParamStr(5)!="") { main1(); //command...
12
5378
by: Rhino | last post by:
I am having an odd problem: the sqlj command on my system doesn't work. I am running DB2 (LUW) V8 (FP8) on WinXP. I haven't done an sqlj program since Version 6 of DB2 (LUW) so I checked the manuals for the proper techniques to prepare an sqlj program. When I went to try the sqlj command, I got this: Exception in thread "main" java.lang.NoClassDefFoundError: sqlj/tools/Sqlj
6
2937
by: Edd Dawson | last post by:
Hi. I have a strange problem involving the passing of command line arguments to a C program I'm writing. I tried posting this in comp.programming yesterday but someone kindly suggested that I'd have better luck here. So here goes! My program ignores any command line arguments, or at least it's supposed to. However, when I pass any command line arguments to the program, the behaviour of one of the functions changes mysteriously. I have...
2
2625
by: Luca Paganelli | last post by:
Hi everybody. I've got a simple but bothering problem. I've just written a little application in C#. I've got a set of business logic classes and a window forms GUI released as a set of libraries (dll). So the GUI class extends the System.Windows.Forms.Form base class and anything else (no Main method). From the class in which I've written the Main method and that's included
1
1429
by: Lionel | last post by:
Hi everyone, I've been practicing C# by writing some programs with the downloadable SDK from Microsoft. I'm writing the programs using Notepad and compiling with the command line compiler. I have Excel installed and I'd like to use the MSChart control but I don't know how to command the compiler to reference it. I've found instructions on the web that say: "Add a reference to the MSChart control to Visual Studio's toolbox. Select...
3
2600
by: MCSD | last post by:
what's the vc++.net compiler name? you have vbc.exe for vb, csc.exe for C#. what's the name for C++? I can't find it. :-( TIA!
4
1606
by: N. P. | last post by:
I do not have Visual Basic .NET Standard or higher but I have downloaded the ..NET SDK and the 101 VB.NET samples from the MSDN website. I am sure that there must be a way to compile and successfully run these 101 samples from the command-line but even though I tried hard there are problems with the resources .resx files. Eg. I tried using the following command to compile one of the 101 samples: vbc *.vb /res:frmMain.resx,frmMain.resources...
0
1422
by: chandan agarwal | last post by:
hi I have been given the task of building vc++ programs at the command line using make software. i have installed gnu make-3.81 version. i was able to build and run makefiles for turbo c++. but when i tried it for vc++ i faced a lot of problems. i found that vc++ has its own linker link and compiler cl. i am giving u a makefile tht was made for turbo c++. can u tell me what changes to i need to do make in it to make it run at the...
51
4162
by: Ojas | last post by:
Hi!, I just out of curiosity want to know how top detect the client side application under which the script is getting run. I mean to ask the how to know whether the script is running under Command Prompt or Browser or some other application? Ojas.
0
9656
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10373
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10118
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8995
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4074
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.