|
|
Hi,
I'm trying to use some of the functions I was using in an MFC application in a console application. I've created a console application with Visual Studio.Net 2003.
Looks like I am missing some header(s). however i cannot find out which. I have added and tried all the header files i can think of.
These are my include files:
//----------------------------------------
#pragma once
#include <fstream>
#include <string>
#include <iostream>
#include <winnt.h>
#include <CommCtrl.h>
#include <windef.h>
#include <PrSht.h>
#include <initguid.h>
#include <stdio.h>
#include <windows.h>
#include <setupapi.h>
#include <devguid.h>
#include <regstr.h>
// my include files
// ...
#include "stdafx.h"
using namespace std;
//----------------------------------------
output:
*******************************************
... \Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\SetupAPI.h(56) : error C2143: syntax error : missing ';' before ...
... \Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\CommCtrl.h(30) : error C2501: 'HRESULT' : missing storage-class or type specifiers
... \Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\PrSht.h(97) : error C2065: 'CALLBACK' : undeclared identifier
... \Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\PrSht.h(97) : error C2501: 'UINT' : missing storage-class or type specifiers
...
...
*******************************************
It looks so strange.
I will be very happy if someone can suggest a solution.
Thanks in advance
|
|
|
|
|
caykahve wrote:
I'm trying to use some of the functions I was using in an MFC application in a console application
Using MFC in a console application ???? It is simply impossible to do that. MFC are (in majority) wrapper classes around the Win32 API thus it is purely a Win32 application.
|
|
|
|
|
I'm trying to use only some of the functions that i had used in my mfc application. this was only to show that they could be compiled.
i am using a win32 console project now.
|
|
|
|
|
|
cedric moonen wrote:
It is simply impossible to do that.
It is simply very easy to do that. What makes you think it is impossible?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Can you use the Win32 API in a console application ?? This seems something really strange to me. Or at least I never heard about that
|
|
|
|
|
cedric moonen wrote:
Can you use the Win32 API in a console application ??
Of course, that is a very common thing to do. Why would you think functions like lstrcpy() , ZeroMemory() , RegOpenKeyEx() , and CopyFile() would be limited to just GUI-based applications?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Mmmhh, yes for that I agree... But everything related to window management cannot be used in console application, am I right ? And so, a big part of the MFC cannot be used neither.
But ok, it doesn't mean that nothing can be used...
|
|
|
|
|
cedric moonen wrote:
But everything related to window management cannot be used in console application, am I right ?
Correct.
cedric moonen wrote:
And so, a big part of the MFC cannot be used neither.
I guess that depends on your definition of "big part." Here is a map of the MFC library that I use. I would not say that a "big part" of the classes were windows-specific. Of the 129 classes shown, about 94 of them can be used in console and GUI applications.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Notice anything pecular about your post? I'll give you a hint: we can't see the names of the header files. Either check the "Do not treat <'s as HTML tags" checkbox, or use the < and > located above the smileys.
That said, you might want to include windows.h before any of the others.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
i want to transfer file between two hosts in different LANs, but there are NATs.
I searched on the website, and ackownlaged that i need a third party server, but i don't kown the detailes of programming .
can anyone give me a way or some hints? i will be very gratefull.
|
|
|
|
|
Here is some code to get you started.
printf("transferring files...\n");
/* Transfer files here */
printf("done!\n");
-- Rocky Dean Pulley
-- DreamSys Software
-- http://www.dreamsyssoft.com
|
|
|
|
|
yanping wang wrote:
want to transfer file between two hosts in different LANs, but there are NATs.
You will need a central server to do that
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
yes. are there any code or articles about that?
|
|
|
|
|
Hi,
How to make command UI fuctions like;
pCmdUI->SetText,
pCmdUI->Enable,
pCmdUI->SetCheck to work when we have a menu in dialog?
Currently it works for menus in SDI/MDI's but not in dialogs
|
|
|
|
|
Manikandan wrote:
How to make command UI fuctions like;
pCmdUI->SetText,
pCmdUI->Enable,
pCmdUI->SetCheck to work when we have a menu in dialog?
Currently it works for menus in SDI/MDI's but not in dialogs
Check this post[^]
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Thanks Jose.
I also found a easy way to do this something as below,
// Get the popup menu which contains the "Lock" menu item.
CMenu* mmenu = GetMenu();
CMenu* submenu = mmenu->GetSubMenu(2);
submenu->CheckMenuItem(ID_LOCK, (m_bLock)?MF_CHECKED : MF_UNCHECKED | MF_BYCOMMAND);
|
|
|
|
|
Well, that's a different approach. It means that whenever (and wherever) you change m_bLock, you have to get to the menu item and change it.
The other approach goes the other way, whenever the menu needs to be shown (and only then), you get the chance to alter its state (enable, check, text, etc.). Besides, it's a general mechanism you can use for any menu item.
But I agree that, if that's the only menu item you need to change and if m_bLock is only changed in a single place, your method is simpler
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I am calling an .exe using ShellExecute in VC++ application in a thread, how do I find out its Process ID
mi
|
|
|
|
|
Use ShellExecuteEx to find out the handle to the process and then use GetProcessId to find out the corresponding process id.
Don't try it, just do it!
|
|
|
|
|
Thanks for the reply but I could not find GetProcessID in msdn. Also could you please tell me how to use ShellExecuteEx.
mi
|
|
|
|
|
Hi,
I am using ADSI api and want to extract Net BIOS name from DNS using C++.
I got following sample from MSDN. But this sample is not compiling. I got following compilation error:
error C2065: 'IADsNameTranslate' : undeclared identifier
I have Included "activeds.h" and "Iads.h" in the header files but still I am not able to get the desired result.
If someone has worked on it then please sent me the working code.
#include "activeds.h"
#include "Iads.h"
int wmain( int argc, wchar_t *argv[] )
{
IADsNameTranslate *pNto;
HRESULT hr;
hr = CoCreateInstance(CLSID_NameTranslate,
NULL,
CLSCTX_INPROC_SERVER,
IID_IADsNameTranslate,
(void**)&pNto);
if(FAILED(hr)) { exit 1;}
hr = pNto->InitEx(ADS_NAME_INITTYPE_SERVER,
CComBSTR("aDsServer"),
CComBSTR("aUser"),
CComBSTR("userDomain"),
CComBSTR("passwd"));
if (FAILED(hr)) { exit 1;}
hr =pNto->Set(ADS_NAME_TYPE_1779,
CComBSTR("cn=jeffsmith,cn=users,dc=Fabrikam,dc=com"));
if(FAILED(hr)) {exit 1;}
BSTR bstr;
hr = pNto->Get(ADS_NAME_TYPE_NT4, &bstr);
printf("Translation: %S\n", bstr);
SysFreeString(bstr);
pNto->Release();
}
Thanks and Regards
Ankur
Regards... Ankur
|
|
|
|
|
Which compiler are you using ?
You might find that is isn't valid for Visual C++ 6.0, just for the .NET versions.
Elaine
The tigress is here
|
|
|
|
|
Thanks for your reply
I am using vc++ compiler.
Actually my requirement is to extract Net BIOS name from DNS.
For this I was planning to use IADsNameTranslate object.
Can you tell me any workaround for implementing this functionallity in VC++ 6.0
Please respond asap.Its Urgent
Thanks and Regards
Ankur
|
|
|
|