|
Hello
i want to work with a Cfile Object in a console application
what should i do please
beacause when i declare a CFile Object in my console app
in the shows the error that Cfile is an indeclared identifier.
thank you
|
|
|
|
|
CFile is an MFC class.
your console project has to support MFC.
then, include windows.h
|
|
|
|
|
Mahhouraaaaaa wrote: i want to work with a Cfile Object in a console application
what should i do please
Use AppWizard to create a console application that supports MFC. No need to manually include windows.h . This is handled automatically by virtue of it being an MFC application.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
-I am creating a program while having the program GUI developed through Windows Form Application (part of VS2005). I have tried to find a tutorial in c++ but haven't been able to find one. I found many in C# but that doesn't really help in c++. I tried morphing some C# code to try to get the c++ code working, but that didn't work. I am trying do develop a test program so I know how to code Windows Foms Applications before I try to do the GUI on the real project.
-I want to be able to have an action happen when a button is clicked here's the code:
<br />
<br />
#include "stdafx.h"<br />
#include "Form1.h"<br />
<br />
using namespace windowsformsapplicationtest;<br />
<br />
[STAThreadAttribute]<br />
int main(array<System::String ^> ^args)<br />
{<br />
Application::EnableVisualStyles();<br />
Application::SetCompatibleTextRenderingDefault(false); <br />
<br />
Application::Run(gcnew Form1());<br />
<br />
<br />
Form1::button1.Click=Application::Exit();<br />
<br />
return 0;<br />
}
When I try to compile this code I get the following error:
.\windows forms application test.cpp(20) : error C2228: left of '.Click' must have class/struct/union
Ind have tried various variations of Form1::button1.Click and don't have a clue what to try anymore, so hopefully someone can help me! What am I doing wrong? How can I fix it?
|
|
|
|
|
In case anyone else hase the same problem later on, I finally (finally after lots of effort) found this.[^]
|
|
|
|
|
try attaching an event function, which the exit inside of that function.
This is why I recommended a tutorial on "Visual C++" not just on C++ or MFC, etc. You will find in the button properties how to add an event function to the putton press, then fill that function with the actual code to what is needed. It will be easier if you learn what the tools do for you, and if you read the code it helps teach you what you need to write yourself.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Thank you very, very, very much.
I finally have a lead on what I am doing wrong.
|
|
|
|
|
Bob X wrote: I finally have a lead on what I am doing wrong.
don't hold your breath or bet your salary on it.... I use visual C++ for OpenGL, not for GUI. I know the process, not the specifics.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Jeffry J. Brickley wrote: don't hold your breath or bet your salary on it....
Ok, I won't hold my breath, but I am trying it out very soon
Hopefully the program will work
|
|
|
|
|
This page contains all you need to move deaper.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/createwindowex.asp
The enemy's gate is down.
Welcome to CP in your language. Post the unicode version in My CP Blog[^] now.
|
|
|
|
|
I have a class A in a dialog application.
A thread X is running in this class. However, i would like to update a member var in class A.
In order to have access to this member var from thread X, i did a static cast like CClassA * pClassA = static_cast<cclassa*>
I know that the above is wrong but, how can i do this?
|
|
|
|
|
Correct.
pass address of instance of class A to thread X parameter.
Kuphryn
|
|
|
|
|
So it would look like:
CClassA pClassA = static_cast<cclassa*>(pClassA);
|
|
|
|
|
x *y = reinterpret_cast<x *>(z)
Kuphryn
|
|
|
|
|
For some reason, images I insert into a list control (whether main item or subitem), always seem to have a white background, and if I change the row color for example, it looks a bit hokey, same with when they are highlighted.
I'm using a transparent image list for the images, which work fine everywhere else where transparency is required, like buttons, etc.
Anybody know any way around this behavior, other than owner draw?
Thanx,
Rick
|
|
|
|
|
When you create the CImageList used to store the various icons for the CListCtrl you need to setup a mask for it at the same time, check the documentation for CImageList:Create[^] for more details.
Gavin Taylor
w: http://www.gavspace.com
|
|
|
|
|
It's already masked. It just seems the list control is painting the background in the color it likes, otherwise I would see bright green.
Code for the image list looks like this:
<br />
m_ImageList.Create(16, 17, ILC_COLOR32 | ILC_MASK, 1, 20);<br />
m_ImageListBmp.LoadBitmap(IDB_LISTIMAGES);<br />
m_ImageList.Add(&m_ImageListBmp, BRGREEN);<br />
BRGREEN is the color I use for transparency.
|
|
|
|
|
I have opened A process(an Exe.) using CreateProcess function,which is running in my system in hiden mode,
I want to send some message to that Exe in my program,that should respond to my message.how i will
i do this. Please anybody help me
nirmal
|
|
|
|
|
Interprocess Communication (IPC) is available in several forms. Some are:
Clipboard
WM_COPYDATA message
Pipes
DDE
Sockets
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi aaaan,
Hope I understood your question
I think it's possible example you can run one Application
and use FindWindow Now and you can insert item to menu(example)
Infact I check this question now and get this answer
|
|
|
|
|
I got the handle of that exe using FindWindow ,then i want to process some message using SendMessage fun but it is not working.
SendMessage(hndl, WM_KEYDOWN, VK_TAB, 1L);
is there anything wrong?.
|
|
|
|
|
Hi aaaan,
I wrote that I tested now,but anyway see(Example)
I run one my application then I use FindWindow with my program name then I get handle from window and Insert a item to menus and this worked and insert my item to Main Menu from another Application for another events (I think Im not sure Its worked)
you try to insert item and see does it work?
|
|
|
|
|
I should send some data to two different places, right now I send all the data to one location through a socket and I need to create another socket to send some other data to a second location as follow:
If (data1){
send to LOC1;
}else
send to LOC2;
This LOC1 connection should always be open, at this point I have the socket and connection to LOC2
Please help me to know how to make the second connection to LOC1, for the first connection to LOC2 the code uses CfgRemoteAddr=127.0.0.1 and some local port: local 1222 and remote 1223.
as follow:
if( hCfg->CfgApiSocket->CfgTCP )
.
...
...
if( !hSocket->sSend( hCfg->CfgApiSocket->CfgRemoteAddr, 0, ( LPSTR )XMLString, XMLSize ))
{
//Socket::sSend( LPSTR Address, INT PortId, LPSTR txBuff, INT txBuffSize )
tmpVar = 0;
memset( Buff, '\0', MAX_LOADSTRING );
tmpVar = hSocket->GetError(( LPSTR )Buff );
LogError( "WEAPIClass", "InSockProcess", "Error sSend Socket: %d, %s", tmpVar, Buff );
LinkStatus( IPC_LINK_DOWN, 0, NULL, 0 );
}
else
{
LogAppDiag( LOGGER_INBOUND_DIAG, XMLString, XMLSize, LOG_FORMAT_ASCII );
}
what Do I need to write to get the second connection?
Appreciate any idea
Nahi
|
|
|
|
|
have to send some data as XML format to two different places right now I send all the data to one location through a socket and I need to create another socket to send some other data to second location as follow:
If (data1)
send to LOC1
else
send to LOC2
and this LOC1 connection should always be open
at this point I have the socket and connection to LOC2
Please help me to know how to make the second connection to LOC1, for the first connection to LOC2 the code uses CfgRemoteAddr=127.0.0.1 and some local port: local 1222 and remote 1223.
as follow:
if( hCfg->CfgApiSocket->CfgTCP )
.
...
...
if( !hSocket->sSend( hCfg->CfgApiSocket->CfgRemoteAddr, 0, ( LPSTR )XMLString, XMLSize ))
{
//Socket::sSend( LPSTR Address, INT PortId, LPSTR txBuff, INT txBuffSize )
tmpVar = 0;
memset( Buff, '\0', MAX_LOADSTRING );
tmpVar = hSocket->GetError(( LPSTR )Buff );
LogError( "WEAPIClass", "InSockProcess", "Error sSend Socket: %d, %s", tmpVar, Buff );
LinkStatus( IPC_LINK_DOWN, 0, NULL, 0 );
}
else
{
LogAppDiag( LOGGER_INBOUND_DIAG, XMLString, XMLSize, LOG_FORMAT_ASCII );
}
Appreciate any idea
|
|
|
|
|
Hello All
How to know the Path where the Application EXE is present in run time?
If multiple copies of the EXE is present in diff directories I have to do some process depeneding on from where it is getting executed.
I tried to search in CWinApp but i could get only the Application Name (m_pszAppName). how to find the whole path of EXE file?
Thanks for your time
Ravi
|
|
|
|