|
I think he meant Command Line Interface, not C++/CLI
|
|
|
|
|
|
I'd look at using something like shared memory - you can then use the argc/argv parameters to pass an address or token to access it.
Named Pipes would also be a good solution I think.
There are plenty of cross-platform implementations for this...
...unless you're passing information between Windows and Linux in separate processes. Then you will probably either have to create a file. If you wanted to go to a little more trouble maybe using TCP sockets would work?
|
|
|
|
|
Hi,
What about using the WriteFile method?
See <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/writefile.asp">http:
Only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
You need to a question!?
|
|
|
|
|
Hi,
I am writing a wrapper for a DLL that has 2 functions:
int func1(long p1);
int func2(char *p1, ...);
The wrapper creates pointes to the two functions:
int (* pfunc1)(long p1);
int (* pfunc2)(char *p1, ...);
To call function 1 I do: wrapper.pfunc1(1234);
My problem is: how do I call func2 using the pointer? Sometimes I may pass 1 parameters, sometimes 2 or 3 or 4, and the data types may change.
Is it possible at all to do this?
Thanks
|
|
|
|
|
yaron klodovski wrote: how do I call func2 using the pointer?
same as you are using pfunc1.
yaron klodovski wrote: Sometimes I may pass 1 parameters, sometimes 2 or 3 or 4, and the data types may change.
you need to assign address of function having prototype same as function pointer.
i.e. function may look like this
int foo(char*,int);
or
int foo(char*,char*,int);
|
|
|
|
|
I wrote a usb mass storage driver and installed it for a special application.
When the driver exists in the system, USB Mass Storage device can not be recognize and the device should be installed manually. It's OK.
But when I would like uninstall the driver by a simple program, the driver can not be uninstalled cleanly some times.
Is there a better solution?
Thanks for your kindly comments.
Best regards.
|
|
|
|
|
Hi,
I want to dynamically created CListView and handle its events, I derived CFileList from CListView and overridden methods like this:
void CFileList::OnNcLButtonDown(UINT n,CPoint p)
{
GetListCtrl().InserItem(0,_T("any thing"));
}
void CFileList::OnLButtonDown(UINT nFlags,CPoint point)
{
AfxMessageBox(_T("Mohammad");
}
and it doesnt seem to work.. so whats the problem??
Note: I am using embedded VC++ 4.0
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
See if this helps.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
I'm currently working on a singel project witch includes many threads. There will be one class which implements the input and output. Next to that, there will be a single object (GLOBAL!) which stores information.
more specific, both the IO class and the threads will communicate with the global storage object, so where to declare it?
The application is fully written in C++ and totally OO
Thanks already!
Koen B
|
|
|
|
|
In your case, implement the global data object as a Singleton class. Whenever you want to use the object, call the specific static method to get its instance. It does not matter where you declare it first.
Best,
Jun
|
|
|
|
|
thanks, i've declared one static object already and used the extern keyword in nearly every file. but i see yours is better
|
|
|
|
|
when i use :
AddString(W2CA(pImageCodecInfo->MimeType)
when compile W2CA these error occur:
f:\visual sutido project\ImageProcessing\ImageProcessing\ImageProcessing\ImageProcessingView.cpp(257): error C2065: '_acp' : undeclared identifier
f:\visual sutido project\ImageProcessing\ImageProcessing\ImageProcessing\ImageProcessingView.cpp(257): error C2065: '_convert' : undeclared identifier
...
is that need some extra include files?
MJM.
|
|
|
|
|
mostafa_pasha wrote: AddString(W2CA(pImageCodecInfo->MimeType)
You are missing a closing parenthesis and a semicolon. Is that intentional?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
excuse me about my fault whole code is:
CPropertiesDlg Dlg;
ImageCodecInfo imgCodecinfo ;
UINT num;
UINT size;
ImageCodecInfo *pImageCodecInfo;
GetImageEncodersSize(&num, &size);
// Create a buffer large enough to hold the array of ImageCodecInfo
// objects that will be returned by GetImageEncoders.
pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
GetImageEncoders(num,size,pImageCodecInfo);
for (UINT j =0; j< num ; j++);
Dlg.m_ListBox.AddString(W2CA(pImageCodecInfo->MimeType));
Dlg.DoModal();
|
|
|
|
|
mostafa_pasha wrote: Dlg.m_ListBox.AddString(W2CA(pImageCodecInfo->MimeType));
You cannot add to a listbox that does not yet exist.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Additionally, if you are using older versions of the ATL macros, you need to type USES_CONVERSION; at the top of the function.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
thanks for your nice help.
but is there newer versions of ATL macros?
if yes how can i use it?
|
|
|
|
|
See here[^] about ATL maybe it is some helpful to you
|
|
|
|
|
Hey, guys.
I have a routine to get the appdata folder that's Vista aware. However, I don't have Vista installed, so I can't test the call to SHGetFolderPathEx, or the REFKNOWNFOLDERID flag that it requires. Anyone here with the Vista dev environment installed who's brave enough to test a function for me? It's VC++, so you should be able to just paste the routine into a test app & call it. Well, you know, theoretically...
Here's the code. I've also included the function to get the current version of Windows so that it'll all compile.
typedef enum<br />
{<br />
eUtilsWinVerUnknown,<br />
eUtilsWinVerWindows95,<br />
eUtilsWinVerWindows98,<br />
eUtilsWinVerWindowsMe,<br />
eUtilsWinVerWindowsNT351,<br />
eUtilsWinVerWindowsNT400,<br />
eUtilsWinVerWindows2000,<br />
eUtilsWinVerWindowsXP,<br />
eUtilsWinVerWindowsServer2003Family,<br />
eUtilsWinVerWindowsVista<br />
}UtilsWinVer;<br />
<br />
<br />
<br />
UtilsWinVer GetWindowsVersion()<br />
{<br />
UtilsWinVer eVersion = eUtilsWinVerUnknown;<br />
<br />
bool bStat = false;<br />
OSVERSIONINFO VersionInfo;<br />
ZeroMemory(&VersionInfo, sizeof(OSVERSIONINFO));<br />
VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);<br />
if (GetVersionEx(&VersionInfo))<br />
{<br />
switch (VersionInfo.dwMajorVersion)<br />
{<br />
case 3:<br />
if (51 == VersionInfo.dwMinorVersion)<br />
{<br />
eVersion = eUtilsWinVerWindowsNT351;<br />
}<br />
break;<br />
<br />
case 4:<br />
switch (VersionInfo.dwMinorVersion)<br />
{<br />
case 0:<br />
if (VER_PLATFORM_WIN32_WINDOWS == VersionInfo.dwPlatformId)<br />
{<br />
eVersion = eUtilsWinVerWindows95;<br />
}<br />
else if (VER_PLATFORM_WIN32_NT == VersionInfo.dwPlatformId)<br />
{<br />
eVersion = eUtilsWinVerWindowsNT400;<br />
}<br />
else<br />
{<br />
}<br />
break;<br />
<br />
case 10:<br />
eVersion = eUtilsWinVerWindows98;<br />
break;<br />
<br />
case 90:<br />
eVersion = eUtilsWinVerWindowsMe;<br />
break;<br />
<br />
default:<br />
break;<br />
}<br />
break;<br />
<br />
case 5:<br />
switch (VersionInfo.dwMinorVersion)<br />
{<br />
case 0:<br />
eVersion = eUtilsWinVerWindows2000;<br />
break;<br />
<br />
case 1:<br />
eVersion = eUtilsWinVerWindowsXP;<br />
break;<br />
<br />
case 2:<br />
eVersion = eUtilsWinVerWindowsServer2003Family;<br />
break;<br />
<br />
default:<br />
break;<br />
}<br />
break;<br />
<br />
case 6:<br />
if (0 == VersionInfo.dwMinorVersion)<br />
{<br />
eVersion = eUtilsWinVerWindowsVista;<br />
}<br />
break;<br />
}<br />
}<br />
return (eVersion);<br />
} <br />
<br />
<br />
CString GetAppDataPath()<br />
{<br />
CString strAppPath = "C:";<br />
<br />
HWND hwndOwner = NULL;<br />
int iFolder = CSIDL_APPDATA | CSIDL_FLAG_CREATE;<br />
HANDLE hToken = NULL;<br />
DWORD dwFlags = 0;<br />
TCHAR szPath[MAX_PATH];<br />
UtilsWinVer eWinVer = GetWindowsVersion();<br />
if (eUtilsWinVerWindowsVista == eWinVer)<br />
{<br />
<br />
DWORD REFKNOWNFOLDERID = 1;<br />
<br />
typedef HRESULT (__stdcall *PFNSHGETFOLDERPATHEX)(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPTSTR pszPath);<br />
<br />
<br />
HMODULE hLib = LoadLibrary("MSI.DLL");<br />
if (hLib)<br />
{<br />
PFNSHGETFOLDERPATHEX lpfnSHGetFolderPathEx = (PFNSHGETFOLDERPATHEX)GetProcAddress(hLib, "SHGetFolderPathEx");<br />
if (lpfnSHGetFolderPathEx)<br />
{<br />
dwFlags = REFKNOWNFOLDERID;<br />
if (SUCCEEDED(lpfnSHGetFolderPathEx(hwndOwner, <br />
iFolder, <br />
hToken,<br />
dwFlags, <br />
szPath)))<br />
{<br />
strAppPath = szPath;<br />
}<br />
}<br />
}<br />
}<br />
else<br />
{<br />
if (SUCCEEDED(SHGetFolderPath(hwndOwner, <br />
iFolder, <br />
hToken,<br />
dwFlags, <br />
szPath)))<br />
{<br />
strAppPath = szPath;<br />
}<br />
}<br />
return (strAppPath);<br />
}<br />
|
|
|
|
|
Hello guys. It's my first application with WinHTTP. Please help me to fix an error.
This errors occurs after include "winhttp.h" file to stdafx.h of my application:
StdAfx.h:
<br />
#ifndef VC_EXTRALEAN<br />
#define VC_EXTRALEAN<br />
#endif<br />
<br />
#ifndef WINVER<br />
#define WINVER 0x0501<br />
#endif<br />
<br />
#ifndef _WIN32_WINNT<br />
#define _WIN32_WINNT 0x0501<br />
#endif <br />
<br />
#ifndef _WIN32_WINDOWS<br />
#define _WIN32_WINDOWS 0x0410<br />
#endif<br />
<br />
#ifndef _WIN32_IE<br />
#define _WIN32_IE 0x0600<br />
#endif<br />
<br />
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS<br />
#define _AFX_ALL_WARNINGS<br />
<br />
#include <afxwin.h><br />
#include <afxext.h><br />
#include <afxdisp.h><br />
<br />
#include <afxdtctl.h><br />
#ifndef _AFX_NO_AFXCMN_SUPPORT<br />
#include <afxcmn.h><br />
#endif // _AFX_NO_AFXCMN_SUPPORT<br />
<br />
#include <winhttp.h>
When I complile this application then I gets following list of the errors:
<br />
..\winhttp.h(285): error C2065: '__in' : undeclared identifier<br />
..\winhttp.h(285): error C2143: syntax error : missing ')' before 'const'<br />
..\winhttp.h(285): warning C4229: anachronism used : modifiers on data are ignored<br />
..\winhttp.h(285): error C2491: 'WinHttpTimeFromSystemTime' : definition of dllimport data not allowed<br />
..\winhttp.h(287): error C2059: syntax error : ')'<br />
..\winhttp.h(292): error C3861: '__in': identifier not found, even with argument-dependent lookup<br />
..\winhttp.h(292): error C2146: syntax error : missing ')' before identifier 'LPCWSTR'<br />
..\winhttp.h(292): warning C4229: anachronism used : modifiers on data are ignored<br />
..\winhttp.h(292): error C2491: 'WinHttpTimeToSystemTime' : definition of dllimport data not allowed<br />
..\winhttp.h(294): error C2059: syntax error : ')'<br />
..\winhttp.h(313): error C2065: 'dwUrlLength' : undeclared identifier<br />
..\winhttp.h(313): error C3861: '__in_ecount': identifier not found, even with argument-dependent lookup<br />
..\winhttp.h(313): error C2146: syntax error : missing ')' before identifier 'LPCWSTR'<br />
..\winhttp.h(313): warning C4229: anachronism used : modifiers on data are ignored<br />
..\winhttp.h(313): error C2491: 'WinHttpCrackUrl' : definition of dllimport data not allowed<br />
..\winhttp.h(317): error C2059: syntax error : ')'<br />
..\winhttp.h(322): error C3861: '__in': identifier not found, even with argument-dependent lookup<br />
..\winhttp.h(322): error C2146: syntax error : missing ')' before identifier 'LPURL_COMPONENTS'<br />
..\winhttp.h(322): warning C4229: anachronism used : modifiers on data are ignored<br />
..\winhttp.h(322): error C2491: 'WinHttpCreateUrl' : definition of dllimport data not allowed<br />
..\winhttp.h(326): error C2059: syntax error : ')'<br />
..\winhttp.h(1029): error C3861: '__in': identifier not found, even with argument-dependent lookup<br />
..\winhttp.h(1029): error C2146: syntax error : missing ')' before identifier 'DWORD'<br />
..\winhttp.h(1029): warning C4229: anachronism used : modifiers on data are ignored<br />
..\winhttp.h(1029): error C2491: 'WinHttpDetectAutoProxyConfigUrl' : definition of dllimport data not allowed<br />
..\winhttp.h(1031): error C2059: syntax error : ')'<br />
Best regards,
Eugene Pustovoyt
ICQ UIN: 161325180
|
|
|
|
|
Eugene Pustovoyt wrote: error C2065: '__in' : undeclared identifier
what version of visual studio you are using. It seems __in definition is present in VC7 and VC8.
|
|
|
|
|
|
Sir,
Can u please suggest me how to write the file extentions .I want to use
vc++ . I was given the code link .But I am sorry to say that It contained errors.Sir, I also want some theoretical knowledge about how to write file extentions.Can u please send me a link .
Thanks
|
|
|
|