Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Maybe you need to lean how to search MSDN for what you want? Such as CreteMenu() Or read a tutorial

HWND hw = CreateWindowEx(x,x,x,x,(HMENU),x,x,x),

The above line does not create a menu. It creates a window that contains a menu.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I used Windows 7 and did not have a problem with that code snippet,

#include <string>
using std::string;

int main(int argc, char**argv)
{
	string arg1 = "one";
	string arg2 = "two";
	string command = "matlab -nosplash -r MyMatlabScript(" + arg1 + " " + arg2 + ");";
	system(command.c_str());
}
'matlab' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't ever use malloc() in a c++ program, its just too confusing to mix malloc() and new together in the same c++ program. Stick with new for consistency and to be less error prone.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Activate the ListBox's SelectedIndexChanged event (use listBox's properties window to do that) and the IDE will generate a function for you, then just do this:

private: System::Void listBox1_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
				 textBox1->Text = listBox1->Text;
			 }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you are still not specific enough. Do you have a win32 program or c++/CLI Windows Forms program?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Depends on what you are programming? *nix? MS-Windows? QT? there are lots of others too. You need to be a lot more specific about what you are coding.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

May be but I m not familiar or learned get or put yet. Is there any other way to do it???

Then google for those functions and find out what they do. If you want to program then you need to learn how to do your own research.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

cross posted here

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It looks to me like its already in C.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Simple solution -- each time the program starts it updates the key value with a new value. Call RegQueryValue() to get the current value, increment the counter, then RegSetKeyValue() to update it.

Call these functions in the order listed. You will have to do error checking to insure they succeed.
RegOpenKeyEx()
RegQueryValue()
RegSetKeyValue()
RegCloseKey()

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

maybe you needed to clear your browser's catch. Usually works for me.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Yes I have an old fashioned phone
:) Here is an old fashioned phone

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Depends on where you live and what kind of landline phone you have. I have a cordless phone and the phone number shows up on its display. But you will have to get with the manufacturer of your phone to find out how it works.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Don't put the file in c:\ root directory because Windows 7 doesn't like it. Make a subfolder and put the file there. I always do my development work from c:\dvlp folder. Don't like having it in c:\Users\<name> because the path is just too long.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Mine did not use precompiled headers. I normally always turn those off. But your problem seems to be a runtime, not compiletime, so that won't make any difference. Also, I'm using VC++ 2010 Express, not vc 5. If that's the compiler you are using then upgrade it because that compiler is 20 years old now and full of bugs.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Have you tried running my version of your program? If yes, did it work? Since the file is created in the current working directory I don't see how it could be a security issue. If it was a security issue then you would not be able to compile the program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I work on 64-bit Windows 7

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

it shouldn't have to be what??? You always need to do error checking to make sure win32 api functions succeed.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your program needs additional error checking -- it works ok for me

#include <windows.h>
#include <stdio.h>
#include <io.h>
#include <string.h>
#pragma warning(disable: 4996)

int main(void)
{
	FILE *fd;
	int ok;
	HANDLE hFile;
	FILETIME createTime;
	FILETIME accessTime;
	FILETIME writeTime;
	fd = fopen("test.txt","a+");
	fclose(fd);

	hFile = CreateFile((LPCTSTR)"test.txt", GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0); 
	if( hFile == INVALID_HANDLE_VALUE)
	{
	printf("CreateFile failed: %d %d\n",hFile,GetLastError());
	}
	else
	{
	if( GetFileTime(hFile,&createTime,&accessTime,&writeTime) != 0)
	{
		writeTime.dwHighDateTime -= 1000L;
		accessTime = writeTime; 
		ok = SetFileTime(hFile,&createTime,&accessTime,&writeTime);
		if( ok != 0)
		{
			printf("SetFileTime success\n");
		}
		else
		{
			printf("SetFileTime error: %d\n",GetLastError());

		}
	}
	CloseHandle(hFile);
	}
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Ryanzp is correct. you need to include <string> to get std::string declared.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 12: you can't use cin >> operator for strings that contain white space (space or tabs). To do that you have to call getline(), e.g. getline(cin,str1);

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is an example of how to create a key. Make sure you read the Remarks section of this link

#include <Windows.h>
#include <iostream>
using std::cout;

int main(int argc, char* argv[])
{
	HKEY hKey = 0;
	DWORD dwDisposition = 0;
	long retval = RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\Ancient Dragon",0,0,REG_OPTION_NON_VOLATILE,
				KEY_ALL_ACCESS,0,&hKey,&dwDisposition);
	if( retval !=  ERROR_SUCCESS)
	{
		char buf[255] = {0};
		DWORD dwError = GetLastError();
		FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,0,dwError,0,buf,sizeof(buf),0);
		cout << buf << '\n';
	}
	else
	{
		RegCloseKey(hKey);
		cout << dwDisposition << '\n';
	}
	return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is what you should be seeing. Notice the error messages appear in the Output window. If you do not see the Output Window then select menu View --> Output and enable it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There are also other subtle differences. A program that runs ok when compiled in Debug mode may be broken when compiled in Release mode. One reason for that behavior is the way the compiler allocates memory for variables when compiled for Debug. Another reason may be over optimization in Release mode.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

@OP
Not really. You can use C. OpenGL has bindings for several languages.

Turbo C++ is a 16 bit compiler, so it can't work with OpenGL. He will just have to do it the hard way with Borland's graphics.h for that compiler.

myk45 commented: Sorry, i forgot the OP mentioning TC as the compiler :) +5
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to double click the error message.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

VC++ does the same thing. Just click the error message and the cursor will be moved to the offending line in the editor.

hkdani commented: Posts useful and practical tips based on an extensive life experience. A model for giving practical and useful advice. +5
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

To copy to another location, open the file in binary mode then read/write 255 bytes at a time until end-of-file is reached. Another way to do it on MS-Windows is call win32 api function CopyFile()

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This works. First you have to export the functions in the DLL that you want to expose to the application program. Here I defined a macro named ADDITIONCLASSAPI so that the same *.h file can be used in both the DLL and application program without change. VC++ 2010 (and earlier versions) define _USRDLL when compiling a DLL project,

// AdditionClass.h
#pragma once 
#ifdef _USRDLL
#define  ADDITIONCLASSAPI __declspec(dllexport)
#else
#define ADDITIONCLASSAPI __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C" {
#endif
ADDITIONCLASSAPI double Add(double x, double y);
#ifdef __cplusplus
}
#endif
// AdditionDLL.cpp : Defines the exported functions for the DLL application.
//

#include "stdafx.h"

// AdditionClass.c
#include "AdditionClass.H"
#include <stdio.h>

#pragma once
#ifdef __cplusplus
extern "C" {
#endif
ADDITIONCLASSAPI double Add(double x, double y){
	return x+y;
}
#ifdef __cplusplus
}
#endif

Then the C++/CLI program. Make sure this program links with AdditionClass.lib

#include "stdafx.h"
#pragma comment(lib,"AdditionDLL.lib")
using namespace System;
#include "AdditionClass.h"
namespace ClrWrapper{
	public ref class AdditionClass{
	public:
		double Add(double x, double y) { return ::Add(x,y);}
	};
}
int main(array<System::String ^> ^args)
{
	ClrWrapper::AdditionClass w;
	double n = w.Add(1.0, 2.0);
    Console::WriteLine(n);
	Console::Read();
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Maybe you should be reading a tutorial

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

have you read this tutorial?

Not sure, but I think the INSERT statement is incorrect QLExecute ("INSERT INTO tblDownloads (DownloadIP , DownloadCount) VALUES('173.201.216.2', 1);");

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

_T is a macro that converts a quoted string leteral to wide character, such as wchar_t something[] = _T("Hello World"); Never heard of _RT macro, and its not defined in tchar.h, where _T is declared.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It would also mean a 2 dimensional array. But I'd have to know what "...bla bla ..." says

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

srand() is used to seed the random number generator srand( time(0)); calling time() will make srand() seed with a different number each time the program is run.

There is no such thing as an infinite character.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Check the WM_CREATE switch statement in WinProc() to see if the buttons are greyed out there.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

LOL :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is one way to convert it to integer. It may not work correctly if the string contains non-numeric digits so you will have to add some error checking.

#include <Windows.h>
#include <iostream>
#include <tchar.h>

int _tmain(int argc, _TCHAR* argv[])
{
	BSTR bstrTemp = L"56";
	int x = 0;
	int len = wcslen(bstrTemp);
	for(int i = 0; i < len; i++)
	{
		x = ((x*10)+bstrTemp[i] - '0');
	}
	std::cout << x << '\n';
	return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think it wasn't your speakers but just my voice is monotone.

Then get someone else with a better speaking voice to do the talking.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

They are not related. DLLs can contain COM programming.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I would like to use a machine gun to go bird hunting. We have blackbirds that fly in herds of thousands. A machine gun would be just the thing to break them up :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Well, I didn't like it either. It was very boring and the speaker was uninteresting to listen to (monotone).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I'm not sure if this will work all the time

It won't. console programs launched from Windows Explorer will always have a console unless the program itself deletes its own console. MS-Windows GUI programs never have a console.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you will have to use Windows Hooks to do that

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

A program doesn't know how it was launched. Another program could have launched it by calling one of several C functions, such as CreateProcess(), system(), ShellExecute(), etc. Or it could be launched by some other non-C program using functions available to it for that purpose.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>char date of birth[15]

There can not be spaces in the object names. One way to code it is to replace spaces with _ character char date_of_birth[15]

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Its hard telling what the actual object is because it's Microsoft internal.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Download Turbo C or Turbo C++, both are good 16-bit compilers with large graphics libraries.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

code between ifdef _cplusplus and endif require c++ compiler, such as make sure the file has *.cpp extension. If you are using a C compiler only then you can't make it compile that c++ code.

I don't know a thing about your other question.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you might find some stff here. Those old games you mentioned probably won't run on Vista or Windows 7 without also running DosBox

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It will depend on the compiler and operating system. Tell us what you are using so that we can be more help.