|
You can use CFile in a console app. The AppWizard for console apps has a checkbox for adding MFC support.
|
|
|
|
|
Tanks all.
It will useful for me, it solve a proble in my other project sow it help me lot, but in this time I am writing service and I need console, I can't use MFC.
|
|
|
|
|
david bagaturia wrote: but in this time I am writing service and I need console, I can't use MFC.
What about fstream ?
|
|
|
|
|
Thanks all.
I have solve problem!!
|
|
|
|
|
Hi,
I am working on RichEdit Control,I am using it in Wizard Dialog.
I want to append & insert Unicode Text at specific position in RichEdit in the format such as (BOLD,ITALIC,ARIAL etc.).
if anyone has idea please tell me.
Thanks,
Swapnil.
|
|
|
|
|
I think you aksed this question on previous messages I suppose you couldn't find answer,If I remember true I think I saw a discuss on the www.codeguru.com(Visual c++ section) about RichEdit(format text,...) see it yesterday
|
|
|
|
|
I'm pretty sure I answered yesterday. Since you didn't believe that answer (apparently) then
maybe you haven't read anything about Rich Edit Controls[^]...
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
I have a fragment of code as an example, and I'm trying to figure out what it does and how.
void WINAPI CLeft::Abc(LinkPtr pData)<br />
{<br />
g_Spec().Xyz(pData);<br />
}
I know CLeft::CLeft is a global outside of any class. It receives callbacks from a server.
I know Xyz is in a class.
I know the pointer pData is being passed.
I think both Abc and Xyz are defined in the same file.
I'm not sure what g_Spec().Xyz() really is.
I'm trying to figure out how and where one defines g_Spec().Xyz(pData) so it can
1)be referenced by Xyz
2)be a class or within a class
Anything look familiar? I really don't know if there is enough here to provide sufficient information.
I am currently using the following and don't like it. It seems too complex, but that's how I got it to work.
Abc is outside any class.
Xyz is a function in CNewDlg.
void WINAPI Abc(LinkPtr pData)<br />
{<br />
((CNewDlg*)AfxGetApp()->m_pMainWnd)->Xyz(pData); <---I don't like this
}
Thanks
|
|
|
|
|
Oliver123 wrote: I'm not sure what g_Spec().Xyz()really is.
From its name it semms to be a global, and from its use I think it could be a global function, returning the reference to a singelton-instance of a class providing a function called Xyz , which takes a parameter that very well could be a LinkPtr .
Oliver123 wrote: void WINAPI Abc(LinkPtr pData)
{
((CNewDlg*)AfxGetApp()->m_pMainWnd)->Xyz(pData); <---I don't like this
}
Have you considered sending a user defined message?
Failure is not an option - it's built right in.
|
|
|
|
|
i have to list all the hardware devices in the system by c language. is there any function to display all the devices. anyone know this. please help me
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
Please don't keep repeating the same question. There is no simple function. You could get all the information you need from the registry.
|
|
|
|
|
Hey, I want to creat a new folder with a new file. Now my code can only creat a new folder but no file.What is the wrong with my code?Please help anyway you can.. Thanks in advance.
m_Luting is the name of the folder , type CString
m_Name is the name of the file ,type CString
My code :
char path[300];
CString stname=".bin";
CString cell;
CreateDirectory(_T(m_Luting), NULL);
strcat(path,m_Luting);
strcat(path,m_Name);
strcat(path,stname);
fstream fMyfile;
fMyfile.open(path,ios:out|ios::binary|ios::trunc);
if(!fMyfile){ exit(-1);}
fMyfile.close();
|
|
|
|
|
zhangguoliming wrote: strcat(path,m_Luting);
This should probably be strcpy() instead.
zhangguoliming wrote: fMyfile.open(path,ios:out|ios::binary|ios::trunc);
What is the value of path at this point?
On a side note, since you are using MFC, have you looked into CFile ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
1) don't put m_Luting in a _T() macro.
2) Since you're using MFC, use it all the way...
if (CreateDirectory(m_Luting))
{
CString sPath;
sPath.Format("%s\\%s%s", m_Luting, m_Name, stName);
CFile file;
CFileException e;
if (file.Open(sPath, CFile::modeCreate | CFile::modeWrite, &e)
{
#ifdef _DEBUG
afxDump << "File could not be opened " << e.m_cause << "\n";
#endif
return;
}
else
{
file.Close();
}
}
else
{
AfxMessageBox("Could not create folder.");
}
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
zhangguoliming wrote: Hey, I want to creat a new folder with a new file. Now my code can only creat a new folder but no file.What is the wrong with my code?Please help anyway you can.. Thanks in advance.
CDiskObject: Simplifying common disk operations[^]
|
|
|
|
|
You can also use of CreateFile for create or open a file
|
|
|
|
|
Hi,
Can I change executable name which my project will produce after compilation, based on some define in projects code.
For example can I have something like:
#define EXE_NAME "MyApp.exe"
such a way that after building the project I will actually get MyApp.exe file?
Using VS 2003, VC++
Thanks,
Mike
|
|
|
|
|
suggam wrote: Can I change executable name which my project will produce after compilation, based on some define in projects code.
I don't think so. The linker, not the compiler, determines the output file name.
Maybe this will work for your needs: OutputFile Property[^]
Mark
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
Try coming up with a post-build step?
-or -
You could always create a custom configuration - instead of using "Win32 Debug", create a configuration called "Win32 MyName Debug". That way, you can assign whatever configuration properties you wanted, including what to call the resulting exe file.
I don't know if VS2003 allows you to specify custom configurations, but VS2005 does.
-- modified at 16:28 Wednesday 14th February, 2007
Can whoever voted this a 1 please explain why you felt the need to do so?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: I don't know if VS2003 allows you to specify custom configurations, but VS2005 does.
VS2003 does. "Build" - "Configuration Manager"
John Simmons / outlaw programmer wrote: Can whoever voted this a 1 please explain why you felt the need to do so?
At least I could bring you to 3.0
Failure is not an option - it's built right in.
|
|
|
|
|
The thing is that builds should happen automatically, so I can not manually create separate build configurations for every executable name I need.
May be there is a way to automatically change project build property by means of some macros which will read the name from some file? Ideally it should parse one of the source files and find particular #define there with the name value to use.
Thanks for yuor answers.
Mike
|
|
|
|
|
I think you're going to have to export the make file and use the command line to build your project using the linker /OUT= parameter to specify the name of the executable file.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Ok, but even in that case I still need to extract that actual name from source file somehow.
So, right now I am thinking about just having some general name for output file after building. Also I will have POST_BUILD action in project settings where some small self-made application will start, it will parse certain source file looking for that #define, extract desired name, and rename resulting output file according to that extracted value.
That seams to be the most straight forward approach
Thanks for your replys guys,
Mike
|
|
|
|
|
Some topics bellow, i discover a way to pass a pointer to a function etc. That whas great.
But the code is in a DLL, and must be called from a VB6 application.
That's the code:
#######################################
#include <windows.h>
struct tpteste
{
int i;
};
void __stdcall test( tpteste **l )
{
tpteste *t = new tpteste[4];
t[0].i = 99;
t[1].i = 98;
t[2].i = 97;
t[3].i = 96;
*l = t;
}
void __stdcall doNothing( void )
{
tpteste *w = NULL;
test(&w);
}
#######################################
I need to discover how to call the test function from VB.
If someone can help... thanks in advance.
|
|
|
|
|
Sorry about the tags.
And about the place to ask, i had a problem: i looked at the "Message Boards" menu at the top right of the screen and couldn't find a VB6 forum, only VB.NET. But after i looked better and found a VB / VB.NET forum, and posted it there. So, sorry about that too. I'm a newbie here.
If anyone can answer i'd be glad to know, and in the future i will be more careful.
Thanks.
|
|
|
|