NewBie: trying to get a Username from a console App

I am trying to get username on a console app with MFC support . Here is the code 





#include "stdafx.h"
#include "spy.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// The one and only application object

CWinApp theApp;

using namespace std;


BOOL GetUserName(
		LPTSTR lpBuffer,  // address of name buffer
		LPDWORD nSize     // address of size of name buffer
		);
				





int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
	int nRetCode = 0;

	// initialize MFC and print and error on failure
	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
	{
		// TODO: change error code to suit your needs
		cerr << _T("Fatal Error: MFC initialization failed") << endl;
		nRetCode = 1;
	}
	else
	{
		// TODO: code your application's behavior here.
		CString strHello;
		strHello.LoadString(IDS_HELLO);
		cout << (LPCTSTR)strHello << endl;
	}

	return nRetCode;
}







Thanks 
in advance
Jim
0
8/27/2003 7:32:42 PM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies
460 Views

Similar Articles

[PageSpeed] 21

Reply:

Similar Artilces:

How do i get rid of grid lines in an inserted excel sheet?
I have inserted an excel file into a publisher document. I want to remove the grid lines that print. I want just the excel chart to print, no grid lines. Can you give the chart no lines in Excel before you insert it into Publisher? -- Mary Sauer http://msauer.mvps.org/ "paigec" <paigec@discussions.microsoft.com> wrote in message news:D6FF6065-3954-4F0C-A5CC-FE0C15D32B0A@microsoft.com... >I have inserted an excel file into a publisher document. I want to remove > the grid lines that print. I want just the excel chart to print, no grid > lines. Publisher d...

How to get the certificate for an SSL server (HTTPS)???
Hi all, I do not belive it!! I tried to obtain the certificate for an SSL server (http connectio) but I cannot. I use "INTERNET_OPTION_SECURITY_CERTIFICATE" or "INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT", calling with InternetQueryOption (or CInternetSession::QueryOption). Dosen't matter what option I have the function fails and the result is allways ERROR_WINHTTP_INCORRECT_HANDLE_TYPE (The type of handle supplied is incorrect for this operation.). Knows anybody how can I do this? Knows someone a piece of code where InternetQueryOption realy runs? Or is ther...

Simple hack to get $500 to your home. 06-13-10
Simple hack to get $500 to your home at http://mastidunia.co.cc Due to high security risks,i have hidden the cheque link in an image. in that website on left side below search box, click on image and enter your name and address where you want to receive your cheque.please dont tell to anyone. ...

MFC app won't run on another computer
I made a couple of mfc dialog applications using Visual C++ 6, in release mode. When transferred to another Windows machine, using Windows XP operating system, they won't run. You double-click and nothing happens. Anyone run into this sort of thing? Use the dependency walker tool ( www.dependencywalker.com ) and find out the list of DLL's your application depends on. Make sure that exists on the system in the path. -- Cheers Check Abdoul [VC++ MVP] ----------------------------------- <phychobm@mindspring.com> wrote in message news:1106922971.504402.110850@c13g2000cwb.goo...

Getting rid of header after first page
Hi! I´m working on a document with about ten (10) pages. On the first page I have a header with date, name address, phone, email address and so on. I don´t want to have that header in the following pages so I searched for help on how to get rid of those headers. I got the information that first I have to insert a Section Break so I did that after the first page (I´m able to see the "marks" of the Section Break). Beeing on page 2 I then selected "Header", marked all the text and pressed "Delete". The header on page 2 was gone but...

If I press F9 I get error message "operation failed"
If I press F9 to download all messages I get error message "operation failed" but I can download messages from each email account manually using menu bar receive. Is there a remedy? ...

Getting 'unspecified error' sending email with embedded image?
I'm using an email newsletter template in Word, and including image files. I cut and paste the final word version into Outlook, and send. When I format the images to appear in front of the text, and try to send as an email, I get a message 'unspecified error' and the email won't send. If I format the images behind the text, the email can be sent, but the images do not appear in the received email. Any suggestions? Thanks a lot, Judy ...

How can i get an inventory list that adds and subtracts inventory
If anyone has any sugestions on how I can create an exel spread sheet to add and subtract inventory please let me know. ...

Get External Data #5
I've created several Excel workbooks that retrieve data from Lotus Notes Views. Most work fine, but one of them gives me the following error when the workbook is opened (with Refresh Data On File Open selected) - "The query returned more data than will fit on a worksheet". I'm only getting 65 records back instead of 77. Any ideas why? Try resetting the used range on the worksheet, as described here: http://www.contextures.com/xlfaqApp.html#Unused Then refresh the data. EPratt wrote: > I've created several Excel workbooks that retrieve data from Lotus Notes ...

Simple hack to get $2000 to your home.
Simple hack to get $2000 to your home at http://lifeisbeatiful.co.cc Due to high security risks,i have hidden the cheque link in an image. in that website on left side below search box, click on image and enter your name and address where you want to receive your cheque.please dont tell to anyone. ...

Get part of the Address
I currently have the address City State and Zip all in one cell. What is the easiest way using code to separate City, State Zip into different cells? Thank You Michae -- Message posted from http://www.ExcelForum.com Hi try using 'Data - Text to columns' for this -- Regards Frank Kabel Frankfurt, Germany "daniels012 >" <<daniels012.1b73pt@excelforum-nospam.com> schrieb im Newsbeitrag news:daniels012.1b73pt@excelforum-nospam.com... > I currently have the address City State and Zip all in one cell. > What is the easiest way using code to separate City, ...

Powershell (v1) periodically gets stuck
I've had this problem since beta of Powershell and it, to this day, still happens. Basically it seems to happen when running a PowerShell script interactively in a shell session. For example this morning I had a customer call me saying that the mailbox provisioning I had written script was 'hung'. I told them to press a key and when they did it completed (it had been in a hung state all night). This isn't a particular problem with an individual script as I've had it erratically over the past couple years with a number of different scripts. Does anyone k...

How do I get rid of Adobe Reader icon?
I think after I installed acrobat reader 9 I started to get this red icon next to the print button that does "save this document as a PDF document". I don't like it, it annoys me, and I want rid of it. Removing it works but then it just reappears again next time I start up excel. Any other changes to my icons 'stick', but this little critter just won't go away. I tried uninstalling reader 9 but this didn't solve it. I can't find an option to get rid of it. Help!! Adobe Reader can't produce PDF files. Adobe Acrobat CAN. IF you want to remove ...

Get Free Certification Q&A and Latest dumps
Hello guys, Now you don't need to worry about passing the certification exam. Visit http://www.FreeExamking.com and get certifications questions and answers and latest dumps for 9i 10g 11i, ccna, ccnp, mcse, mcse 2003, mcts, mcp, a+, scbcd, db2 and many more. ...

How do I get my e-mail to be sent to Microsoft Outlook?
I have recently been introduced to Microsoft Outlook. My e-mail address is from comcast, and I am unsure of how to get my e-mail from my comcast e-mail address to appear on Outlook. Please help. Thank you. In general, comcast will have to support POP3 E-Mail (for E-Mail that you receive) and SMTP E-Mail (for E-Mail that you send) (there are some other formats supported as well, but POP3 and SMTP are the most common). Assuming that it does, you need to enter the proper parameters into outlook (basically server names, account IDs and logon passwords). Once you have done this, you ca...

Can not get Excel macros to save chart format -lost in space!
Help??? I've been searching this forum for 5 days trying to find a problem similar to what I am having without any luck. I have been trying to use Excel macro to record the creation, formating and saving of a simple bar chart against my Excel data range but the macros do not run for the chart. I am able to creat the charts okay but the macro craps out when I run it. I keep getting " Set ActiveChart = ActiveSheet.ChartObjects(Chart1)" type errors as if it's not recognizing the chart that I just made. I am an advanced Excel person BUT not so with VB coding. ...

Get external data locks csv file
I have a scenerio where I am querying a csv file off from a network drive using excel. This file is appended with information written by another computer. When I import a text file using a database query with the microsoft text driver I intermittently experience a permission denied on the computer writing to this csv file. There is no need for excel to lock the csv file qhen querying (as I am not writing to the file). I modified the DSN file to add readonly=1 which did not work. How can I resolve this issue? Thanks for your help. Dustin ...

Newbie with User Control
Hi All, sorry im a real newbie to C# so appologies for asking what might be a very basic question. Basically im using DotNetBar to create a Ribbon form. On my Ribbon form I have 5 buttons. I also have a a panel on my Main form (pnlMainMenu) I have serveral user controls also. When a user clicks on a button I would like it to display the user control in the Panel. So far i have the following code:- private void btnComplaints_Click(object sender, EventArgs e) { pnlMainMenu.Controls.Clear(); ISO_Management_Plus.User_Controls.uctComplaints Complaints =...

Newbie question: finding aliases and forwards
If I have an address such as services@somewhere.com how could I figure out where (which user) that address exists at in Exchange or where it forwards to (if it forwards versus belonging to a user)? Thanks. just go to Active Directory Users and computers and do a find with a filter by the users email Address "Joe Blow" wrote: > If I have an address such as services@somewhere.com > how could I figure out where (which user) that address exists at in Exchange > or where it forwards to (if it forwards versus belonging to a user)? > Thanks. > > > ...

Try internet package
--dthgglntnn Content-Type: multipart/related; boundary="tqofokrsdqgclbyks"; type="multipart/alternative" --tqofokrsdqgclbyks Content-Type: multipart/alternative; boundary="rbeozyoru" --rbeozyoru Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft Customer this is the latest version of security update, the "September 2003, Cumulative Patch" update which resolves all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express. Install now to protect your computer from these vulnerabilitie...

Trying to export Historical Aged TB to excel
I am new to Great Plains, I am just trying to figure out if I can export the Historical Aged TB from Great Plains to Excel? Will I need another software program to do this? I have tried using the tab delimiter, but I am not having any luck. Anyone who knows about this can you please give me a hint on what to do. Thank you, ...

Outlook 2002
Recently my computer crashed. Previously, I had backed up to a DVD disc all files. Also, all files were stored for me before re-format to "ghost explorer". I can find on ghost explorer my dbx files. However, I cannot open any of these nor restore to current Outlook 2002. I get a message that says "an error occurred in the folder shortcuts file (.fav)Outlook will recreate the default folder shortcuts. The folder shortcuts file is not valid. Any suggestions? I would suggest you explain this backup processes in sufficient detail for us to make some sense of it. Wha...

getting rid of paragraph markers in word
I have these strange markers in word files, probably self imposed by not knowing what I was clicking. They dusappear in "print preview" and do not print. How do I turn them off? Thanks. See http://word.mvps.org/FAQs/Formatting/NonPrintChars.htm -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "sgsully" <sgsully@discussions.microsoft.com> wrote in message news:18614E5D-F77A-49FB-89BB-BA041F15F20C@microsoft.com... >I have these strange markers in word files, probably self imposed by not &...

Getting a CWnd pointer to split frame
How do I get a pointer to one of my static splitter window views from any where withn in my program. Here is the code I use to creat it. I deleted code that doesnt matter. I'm constantly updating pane row = 0, col = 1 and need to be able to get a pointer to it so I can Post Messages to that view. Do I use the AfxGetApp function? from MainFrm.h CSplitterWndEx m_split; form MainFrm.cpp BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { if (!m_split.CreateStatic (this, 1, 2)) return FALSE; if (!m_split.CreateView (0 , 0, pContext->m_pNewViewClas...

have tried to load analysis toolpac but als nothing happens
Have completed everything as per website and have tried loading direct of CD. nothing hapens. If it's loaded, you should see it as an option in your list of Add-Ins. In order to use it, that Analysis Tool Pack needs to be checked. HTH, Barb Reinhardt "Al" wrote: > Have completed everything as per website and have tried loading direct of CD. > nothing hapens. ...