|
GetCurrentDirectory()
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Can you tell me detail of this function usage? Because, I can't use returned value (second parameter) of this function as a string.
|
|
|
|
|
mehmetned wrote: Can you tell me detail of this function usage?
See here.
mehmetned wrote: I can't use returned value (second parameter) of this function as a string.
Why not? Just assign it to a std::string object.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Then how do you want to get the Current Directory..?
"Dream bigger...Do bigger...Expect smaller"
aji
|
|
|
|
|
#include "stdafx.h"
#include <windows.h>
int main(int argc, char* argv[])
{
TCHAR szCurDir[MAX_PATH];
GetCurrentDirectory(MAX_PATH, szCurDir);
printf(strcat(szCurDir,"\n"));
return 0;
}
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
I would like just ask what it is the best way to transfert data between software. The is many way , DCOM, DDE, or TCPIP connection . The software that I will use have to run on the same PC.
I know that it is possible to used TCPIP but I do not know if it is a good solution ! I have never used the DCOM !
Thank you.
AutreChien
|
|
|
|
|
Memory-mapped file (MMF) is the lowest level of all the IPCs you described. It is also the fastest. The rest all has more or less overhead added. On Windows, MMF is also vaguely called "shared memory".
Best,
Jun
|
|
|
|
|
However, TCP has the very nice benefit that should you ever want to move one of these programs to a separate computer, you've done most of the work already.
earl
|
|
|
|
|
Maybe you need to clarify just a few things:
What kind of data you want to exchange ?
How often will data be exchanged ?
Are you sure the application will ALWAYS have to run on the same PC ?
Will you need the code to be portable ?
On the same PC:
- You can use WM_COPYDATA message.
- You can use the clipboard to exchange data. This is very easy. RegisterClipboardFormat will be needed if your data is not text.
- Memory map file is easy and efficient.
- Shared memory. Article on codeproject[^]
- DDE is a bit more complex. Might want to read this[^]
- Sockets. Fast and easy at low level. Can be tricky for newcomers. Might want to use a class provided on this site. Many articles on this site.
If the data will need to be exchanged from different computers, then sockets will be the way to go. If you can use a known protocol, HTTP for example, then use it. Again, if your not familiar with sockets and protocols, it can be a lot of work and tricky to implement, so use an existing class.
my five cents.
Louis
* google is your friend *
|
|
|
|
|
What kind of data you want to exchange ?
-char or container that will contain a structur of data.
How often will data be exchanged ?
- 2-10 times per hours.
Are you sure the application will ALWAYS have to run on the same PC ?
- Actualy it will be only of one computer but it is possible that change (not for this project!).
Will you need the code to be portable ?
-No.
When you say socket it is conection using TCPIP ?
In your list there is not the DCOM, it is from you side not a possible solution ?
Thank for your help.
AutreChien
|
|
|
|
|
sockets is the name of the interface/library usually used to to TCP or UDP communications.
earl
|
|
|
|
|
Salut AutreChien,
NorGUI wrote: When you say socket it is conection using TCPIP ?
Sockets are used to communicate using TCP or UDP protocols. When you say TCP/IP it means using TCP (Transmision Control Protocol) of the IP (Internet protocol) suite. It is the same thing.
NorGUI wrote: In your list there is not the DCOM, it is from you side not a possible solution ?
I am not an expert with COM, but here's what I know.
1) DCOM is an extension to COM that allow communication accross a network. In your case, on the same PC you only need COM.
2) COM is an object model. I think to use that with your applications, you would create a project to create that object. Then your applications will have to use this object, that will need to be installed (registered) on the PC. It will give you an object that you can use from different applications, independent of their programming model.
More info on COM[^]:
3) Where I work, we have created ActiveX controls to be used on IIS servers to access different resources. It works fine, but can be somewhat complex and sometimes hard to debug. I think ActiveX closely resemble COM.
4) This is all very Windows. Not portable.
5) If your application will not be exchanging data more then you mention and wont exchange across different PCs and you are already familiar with COM, then it may be the right choice for you.
Louis
* google is your friend *
|
|
|
|
|
An ActiveX control is a COM object that implements a particular set of interfaces.
earl
|
|
|
|
|
Salut Louis,
Point 5)
I do not have any experience with COM implementation and I do not know if it is easy to start and have operationel COM ?
And if I start with COM and I will comunicate between application there not on the same PC I will need to switch to DCOM and it will be again a lot of works, I think.
If I start with TCP/UDP it will possible to switch without any problem in any time to comunicate between aplication running on many PC.
I used TCP with IP connection but I do not know how to use TCP without IP (for sample when I will comunicate between aplication running ion the same PC and TCP protocol).
Thank you !
AutreChien
|
|
|
|
|
Salut AutreChien,
To communicate using TCP (TCP/IP is the same thing) you will be using sockets. You create a socket for TCP by specifying SOCK_STREAM as the familly (type). All the logic for transferring packets with this protocol is handled by the socket library so you dont need to worry about that. You then connect to a remote or local address (you probably will be using 'localhost' as the address for the local PC), then you send and receive data using the proper functions (send and recv) and giving a buffer with data to send (or buffer to receive data). It is traitforward at the base.
If you already used sockets then you already know how to do it. If not, you will need to read about sockets, there is a lot of info about that on the net and on this website.
An advice to you, do not use MFC sockets, the CSocket class, it is not very efficient. CAsyncSocket is acceptable since it does not have a lot of overhead built in it. Depending on your knowledge of sockets, you can go with basic socket object and create your own class or find a class here on CodeProject, just make sure it is not a class derived from CSocket.
If you are using Visual C++, look up the CAsyncSocket in the help (in MSDN) and you should find a sample called CHATSRVR (Chat server) it probaly will be a good starting point for what you want to do.
Here's a good reference[^] for Windows sockets.
Bonne chance et joyeuse programmation
Louis
* google is your friend *
|
|
|
|
|
I would encapsulate the code in a class so that the actual sharing mechanism would be hidden from the program. For the short term, I'd recommend using shared memory.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hi all,
I want to Resize the CDialog when i Press the Mouse at the Edges of the CDialog.
Is it possible to Size Accordingly when i Press the CDialog at the Edges. and also when i Drag at the End of the Dialog it must size accordingly.
please give a snippet of code.
uday.
|
|
|
|
|
try thid
ShowWindow(SW_MAXIMIZE); in oninitdialog function
Ashish Dogra
MCA
Noida
|
|
|
|
|
ashish dogra wrote: ShowWindow(SW_MAXIMIZE);
Exactly how does this address Uday's need?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Set the Border property of the dialog to Resizable
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
hi.. I must implement an interpreter in C programming language that will get the source code of a program in text file format and execute it.
but i don't know C language enough to write this interpreter. so I need this interpreter code that is written with C language.(or it can be C++) I searched this codes in google and some websites, but codes which I found are useless..
if you can help me, you gladden me.
please help me.. this effects my graduation..
*************************
a part from my homework;
Your interpreter program will accept and execute statements below:
• int variable_name
• cin>> variable_name
• cout<< variable_name
• variable_name = infix arithmetic expression (variable names, +, -, *, /, and parentheses (..)).
• for loop
• if else statement
(your interpreter does not need to recognize and execute nested for and if/else statements .
It should give error messages. Possible syntactic errors relating source code input are:
• Undefined variable <variable_name>
• Paranthesis mismatch
• Curly brackets mismatch
For the arithmetic expression evaluation you are free to use directly an existing evaluator program source code like polish notation within your interpreter.
|
|
|
|
|
Read #9 here.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
ayshe wrote: please help me.. this effects my graduation..
Good luck !!!
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|