Click here to Skip to main content
15,897,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Single Instance restriction Pin
Jitendra gangwar6-May-04 20:31
Jitendra gangwar6-May-04 20:31 
GeneralCFileFind Pin
ykutanoor6-May-04 19:24
ykutanoor6-May-04 19:24 
GeneralRe: CFileFind Pin
Anonymous6-May-04 21:57
Anonymous6-May-04 21:57 
QuestionHow to detect whether or not the current window is console window. Pin
Truong D. Toan6-May-04 18:14
Truong D. Toan6-May-04 18:14 
AnswerRe: How to detect whether or not the current window is console window. Pin
Abin6-May-04 20:52
Abin6-May-04 20:52 
Questionwhats the CListCtrl's equivalent of SetCurSel ? Pin
Anonymous6-May-04 17:51
Anonymous6-May-04 17:51 
AnswerRe: whats the CListCtrl's equivalent of SetCurSel ? Pin
Anonymous6-May-04 21:30
Anonymous6-May-04 21:30 
QuestionCan anyone help with my code??? Pin
Draco02836-May-04 17:45
Draco02836-May-04 17:45 
I am really new to C++ and I dont have a clue what Im doing yet. I keep reciving the following compiler error
c:\Documents and Settings\Owner\My Documents\Visual Studio Projects\Windows Forms\Form1.h(144): error C2065: 'hInstance' : undeclared identifierConfused | :confused: The code itself is listed below. If anyone can help me I would apprecaite it very much

<code>
//////////Form1.h  
#pragma once

HWND hw;
         MSG  msg;
         int status;
		 
namespace WindowsForms
{
    	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary> 
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the 
	///          'Resource File Name' property for the managed resource compiler tool 
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public __gc class Form1 : public System::Windows::Forms::Form
	
	{	

		public:
		Form1(void)
		{
			InitializeComponent();
		}
  
	protected:
		void Dispose(Boolean disposing)
		{
			if (disposing && components)
			{
				components->Dispose();
			}
			__super::Dispose(disposing);
		}
	private: System::Windows::Forms::Button *  button1;
	private: System::Windows::Forms::Button *  button3;
	private: System::Windows::Forms::Button *  button4;
	private: System::Windows::Forms::TextBox *  textBox1;


	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container * components;

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->button1 = new System::Windows::Forms::Button();
			this->button3 = new System::Windows::Forms::Button();
			this->button4 = new System::Windows::Forms::Button();
			this->textBox1 = new System::Windows::Forms::TextBox();
			this->SuspendLayout();
			// 
			// button1
			// 
			this->button1->Cursor = System::Windows::Forms::Cursors::Hand;
			this->button1->ForeColor = System::Drawing::Color::Black;
			this->button1->ImageAlign = 

System::Drawing::ContentAlignment::TopCenter;
			this->button1->Location = System::Drawing::Point(1, 0);
			this->button1->Name = S"button1";
			this->button1->Size = System::Drawing::Size(208, 38);
			this->button1->TabIndex = 0;
			this->button1->Text = S"Set Desktop Wallpaper";
			this->button1->Click += new System::EventHandler(this, button1_Click);
			// 
			// button3
			// 
			this->button3->Cursor = System::Windows::Forms::Cursors::Hand;
			this->button3->ForeColor = System::Drawing::Color::Black;
			this->button3->Location = System::Drawing::Point(1, 38);
			this->button3->Name = S"button3";
			this->button3->Size = System::Drawing::Size(208, 38);
			this->button3->TabIndex = 3;
			this->button3->Text = S"Grand Finale";
			this->button3->Click += new System::EventHandler(this, 

button3_Click_1);
			// 
			// button4
			// 
			this->button4->ForeColor = System::Drawing::Color::Black;
			this->button4->ImageAlign = 

System::Drawing::ContentAlignment::BottomCenter;
			this->button4->Location = System::Drawing::Point(1, 76);
			this->button4->Name = S"button4";
			this->button4->Size = System::Drawing::Size(208, 38);
			this->button4->TabIndex = 4;
			this->button4->Text = S"Exit";
			this->button4->Click += new System::EventHandler(this, button4_Click);
			// 
			// textBox1
			// 
			this->textBox1->ForeColor = System::Drawing::SystemColors::HotTrack;
			this->textBox1->Location = System::Drawing::Point(1, 112);
			this->textBox1->Name = S"textBox1";
			this->textBox1->ReadOnly = true;
			this->textBox1->Size = System::Drawing::Size(208, 20);
			this->textBox1->TabIndex = 5;
			this->textBox1->Text = S"";
			this->textBox1->TextAlign = 

System::Windows::Forms::HorizontalAlignment::Center;
			// 
			// Form1
			// 
			this->AutoScaleBaseSize = System::Drawing::Size(5, 13);
			this->ClientSize = System::Drawing::Size(210, 136);
			this->Controls->Add(this->textBox1);
			this->Controls->Add(this->button4);
			this->Controls->Add(this->button3);
			this->Controls->Add(this->button1);
			this->Cursor = System::Windows::Forms::Cursors::No;
			this->FormBorderStyle = 

System::Windows::Forms::FormBorderStyle::FixedToolWindow;
			this->Name = S"Form1";
			this->Text = S"A Little Something Just For You";
			this->TransparencyKey = System::Drawing::Color::Crimson;
			this->Load += new System::EventHandler(this, Form1_Load);
			this->ResumeLayout(false);

		}	
	private: System::Void Form1_Load(System::Object *  sender, System::EventArgs *  e)
			 {
			 }
	private: System::Void button4_Click(System::Object *  sender, System::EventArgs *  e)
			 	{
				textBox1->Text = S"Your not getting away that easy";
				}
			  	
private: System::Void button3_Click(System::Object *  sender, System::EventArgs *  e)
      
			 //IDD_DIALOG2 Needs to open
			 {
				 BOOL CALLBACK DialogProc (HWND hWnd, UINT uMsg, WPARAM 

wParam, LPARAM 
				 lParam);
hw = CreateDialog( hInstance , MAKEINTRESOURCE ( 102 )  ,NULL,
reinterpret_cast<DLGPROC>(DialogProc ));
		 	 }

private: System::Void button1_Click(System::Object *  sender, System::EventArgs *  e)
		 {
// Change the wallpaper to C:\wallpaper.bmp
 SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, (void*)"wallpaper.bmp", SPIF_UPDATEINIFILE | 

SPIF_SENDWININICHANGE);    
		 }

private: System::Void button3_Click_1(System::Object *  sender, System::EventArgs *  e)
	 {
	 }

};
}

/////Form1.cpp


#include <WinUser.h>
#include "stdafx.h"
#include <windows.h>
#include <stdlib.h>
#include "Form1.h"


using namespace WindowsForms;

int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
	System::Threading::Thread::CurrentThread->ApartmentState = 

System::Threading::ApartmentState::STA;
	Application::Run(new Form1());
	return 0;
}
</code>


Thanks for any and all help
Draco
AnswerRe: Can anyone help with my code??? Pin
Maxwell Chen6-May-04 19:54
Maxwell Chen6-May-04 19:54 
GeneralRe: Can anyone help with my code??? Pin
Draco02837-May-04 3:05
Draco02837-May-04 3:05 
GeneralRe: Can anyone help with my code??? Pin
Juergen Froehlich7-May-04 11:52
Juergen Froehlich7-May-04 11:52 
Generalamplitude demodulation Pin
langzi546-May-04 14:55
langzi546-May-04 14:55 
GeneralRe: amplitude demodulation Pin
Roger Wright6-May-04 20:39
professionalRoger Wright6-May-04 20:39 
GeneralRe: amplitude demodulation Pin
Anonymous6-May-04 20:55
Anonymous6-May-04 20:55 
GeneralRe: amplitude demodulation Pin
Roger Wright7-May-04 2:59
professionalRoger Wright7-May-04 2:59 
QuestionHow to close Handle in MSVC++ 1.52 Pin
Anonymous6-May-04 14:31
Anonymous6-May-04 14:31 
AnswerRe: How to close Handle in MSVC++ 1.52 Pin
Anthony_Yio6-May-04 15:48
Anthony_Yio6-May-04 15:48 
GeneralRe: How to close Handle in MSVC++ 1.52 Pin
Steve S6-May-04 22:33
Steve S6-May-04 22:33 
GeneralRe: How to close Handle in MSVC++ 1.52 Pin
Juergen Froehlich7-May-04 12:08
Juergen Froehlich7-May-04 12:08 
AnswerRe: How to close Handle in MSVC++ 1.52 Pin
Antony M Kancidrowski6-May-04 23:52
Antony M Kancidrowski6-May-04 23:52 
Questionhow to start another application in my application Pin
marmotchen6-May-04 14:10
marmotchen6-May-04 14:10 
AnswerRe: how to start another application in my application Pin
Jarek G6-May-04 14:19
Jarek G6-May-04 14:19 
AnswerRe: how to start another application in my application Pin
David Crow7-May-04 3:05
David Crow7-May-04 3:05 
QuestionWhat is the best way to implement an IP tunneling protocol? Pin
jaybz6-May-04 12:22
jaybz6-May-04 12:22 
GeneralFolder Pin
Ni@m6-May-04 10:26
Ni@m6-May-04 10:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.