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

dumb question...


This might be an extremely dumb question; I'm new to Visual C++, and am trying to use the simple Spooler API, OpenPrinter, but when I try to compile my source file, it says OpenPrinter is an undeclared identifier. Here's how I'm trying to use it

HANDLE newPrinter = NULL
BOOL op = OpenPrinter(ps09, &newPrinter, NULL)

Now, as far as I'm concerned there should be nothing wrong with that code, but does anyone else know what might be the problem? I'm using Visual C++ 6.0 on Windows XP. Thanks

Nov 17 '05 #1
5 1528
Need Help wrote:
This might be an extremely dumb question; I'm new to Visual C++, and
am trying to use the simple Spooler API, OpenPrinter, but when I try
to compile my source file, it says OpenPrinter is an undeclared
identifier. Here's how I'm trying to use it:

HANDLE newPrinter = NULL;
BOOL op = OpenPrinter(ps09, &newPrinter, NULL);

Now, as far as I'm concerned there should be nothing wrong with that
code, but does anyone else know what might be the problem? I'm using
Visual C++ 6.0 on Windows XP. Thanks!


Did you #include <windows.h>?

-cd
Nov 17 '05 #2
Need Help wrote:
Yes, windows.h was included. There isn't anything other than that I
should have to include to get OpenPrinter, right?


Nope. The following compiles:

// Code
#include <Windows.h>

int main()
{
HANDLE hPrinter;
OpenPrinter("",&hPrinter,NULL);
}
// End of code

Exactly what error(s) are you getting?

-cd

Nov 17 '05 #3
Here's the error I got
error C2065: 'OpenPrinter' : undeclared identifie

My boss suggested it might have something to do with the fact that I'm not an administrator on the machine, and that perhaps this API tries to do something with the registry that I don't have access to. He's going compiling it on his and see if it works there. Thanks

----- Carl Daniel [VC++ MVP] wrote: ----

Need Help wrote
Yes, windows.h was included. There isn't anything other than that
should have to include to get OpenPrinter, right


Nope. The following compiles

// Cod
#include <Windows.h

int main(

HANDLE hPrinter
OpenPrinter("",&hPrinter,NULL)

// End of cod

Exactly what error(s) are you getting

-c


Nov 17 '05 #4
No, the compiler knows nothing about who is and isn't an administrator, so
that can't be it (which doesn't mean that it won't work on your boss'
machine).

Can you post a complete example that doesn't compile for you? (Something
small - not your entire app. Frequently attempting to make a small program
that reproduces the problem will lead you to discover what's really wrong).

-cd

Need Help wrote:
Here's the error I got:
error C2065: 'OpenPrinter' : undeclared identifier

My boss suggested it might have something to do with the fact that
I'm not an administrator on the machine, and that perhaps this API
tries to do something with the registry that I don't have access to.
He's going compiling it on his and see if it works there. Thanks!

----- Carl Daniel [VC++ MVP] wrote: -----

Need Help wrote:
> Yes, windows.h was included. There isn't anything other than

that I > should have to include to get OpenPrinter, right?

Nope. The following compiles:

// Code
#include <Windows.h>

int main()
{
HANDLE hPrinter;
OpenPrinter("",&hPrinter,NULL);
}
// End of code

Exactly what error(s) are you getting?

-cd

Nov 17 '05 #5
It turned it just some goofy pre-compiled header that Visual C++ adds in for you. I got rid of it and now it works fine. Thanks for your help!
Nov 17 '05 #6

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

Similar topics

16
by: squash | last post by:
a dumb question i had on my mind: Say you have a dynamically created web page . Isn't it more secure to write it in php since a visitor will not be able to tell it is dynamically created? But...
15
by: Good Man | last post by:
Hey there I have a dumb question.... Let's say i have a database full of 4000 people.... I select everything from the database by: $result = mysql_query("SELECT * FROM People");
3
by: ed | last post by:
I've just started working with .Net, so appologize for what is probably a really dumb question. Did Windows XP originally come with the .Net framework installed, and if so which version? ...
2
by: InvisibleMan | last post by:
Hi, I feel a little dumb for asking this (considering im writing TSQL) but there doesn't seem to be any definitive answers on the search engines... Okay I understand that if you open the ADO...
2
by: TGF | last post by:
How do you copy a String type into a native char buffer? Dumb question, but not sure how to do it :( TGF
10
by: Edward | last post by:
I've just taken over maintaining a system from a colleague who has left. I find the following line in her code: Dim params(2) As SqlClient.SqlParameter params(0) = New...
4
by: Stelrad Doulton | last post by:
Hi, Apologies if this isn't the correct forum. I am writing a communication solution (actually on the Compact Framework) based on HttpWebRequests hooking up with custom handlers on the...
2
by: Bill Nguyen | last post by:
I would like to add a new VB.NET project using the same folder being used by another project so that I can share several forms already creaded by the other project. However, .NET created a new...
6
by: Robert Dufour | last post by:
What is the meaning of the word marshal and unmarshal in plain english as applied to an exe file? Does it mean the application has started and ended? Thanks for any help, Happy new year, Bob
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
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: 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:
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...
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...

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.