|
you need to use a "\\" in the end _T("D:\\CompressionTest\\"); otherwise you are putting a escape sequence
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
chandrakar ashish wrote: CHAR szBuf[80];
DWORD dw = GetLastError();
sprintf(szBuf, "failed: GetLastError returned %lu\n",dw);
MessageBox(NULL, szBuf, "Error", MB_OK);
It's not a mistake per se, but since you are using MFC, why not have:
CString szBuf; <br />
DWORD dw = GetLastError(); <br />
<br />
szBuf.Format("failed: GetLastError returned %u\n",dw); <br />
<br />
AfxMessageBox(szBuf);
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I have the same problem, and I am not using MFC.
From several partiotins that I have, the GetVolumeInformation failed 2x.
Using the FormatMessage
char *errorBuf = 0;
if (
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(), //the error message
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &errorBuf,
0,
NULL)
)
{
MessageBox (NULL, errorBuf, "BuildIndex - Error",MB_OK);
LocalFree (errorBuf);
}
The message box says "The filename, directory name, or volume label syntax is incorrect"
But explorer shows the right label for those partitions.
So It must be another way to collect information and getting the right label.
==== EDIT ====
Never mind, I got the answer. I added '\\' to the drive name. The funny thing was, It was successfully without adding the '\\' on some partitions
|
|
|
|
|
//I reposted this message to have it appear in first page of the forum. I didn't get any reply last time, so I hope would be better this time
Hello,
I am having troubles with applying themes to my application. I have a MFC project developed under VS2008 which can by default settings change the appearance (theme) of the mainframe. It is the SDI application with splitters where I use many CformViews. The problem is that the views are not themed at all. I searched many site for solving that problem but found no answer.
- My application automaticly generate the manifest, so I don't think the problem is in that. The mainframe changes the theme.
- in my app class in InitInstance() I call
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
what I found is important for initializing the themes. It was automatically done by VS in my app.
Can you please help me to solve my problem. Do I need to change something in my views?
Thank you very much, Tomas
|
|
|
|
|
Hi,
I am working in development of Active X control in VC++ .I need to create a property for FONT to have GetFont & SetFont. I have developed with default setting when I debug the code using Activex control test container I can go GetFont function in the code when I invoke GetFont but I try for SetFont it doesn’t moves to SetFont instead it goes to GetFont.
When I check with MSDN I came to know that IFontDisp is used which is inturn inherited to IDispatch which provides write access to set function only when we set the flag DISPATCH_PROPERTYPUT.
Could any one suggest me what are the steps to be taken to move the into Setfont function.
Thanks in Advance,
G.Girish
|
|
|
|
|
What is the problem of integrating the DISPATCH_PROPERTYPUT? It is the key (but I have no clue)
ActiveX is sometimes strange
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hello,
I am doing socket programming in VC++. I have two applications for Server and Client(in VC++). Message can be send/receive with these two applications from server to client or vice-versa.
I download one HL7 Toolkit. I want to communicate this Toolkit with my applications. They did socket programming, but in Java.
I want to know, can we send data if sender side socket is created in VC++ and on receiver side socket created in Java. Is socket programming is platform independent?
Thanks in advance
|
|
|
|
|
Yes socket programming is platform Independent.
Do not trust a computer...
Always check what computer is doing
regards,
Divyang Mithaiwala
Software Engineer
|
|
|
|
|
Socket programming is really platform independent, but watch out for bit order. (LSB and MSB)
Consider it as posting bits through the cable.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Yes, it is platform independent, but you need to take care below points when going across different platform (in terms of processer)
1) Before send data, convert your data in to network type. (ex. using "htonl" function.)
2) if you passing whole structure as a binary data then need to take care about padding. (use __attribute__((__packed__)))
Parag Patel
Sr. Software Eng, Varaha Systems
|
|
|
|
|
thanks.
But now i can't send or receive the data from Toolkit which i download. My application is in VC++ and Toolkit is in Java. Is there any function i have to add in my application.
|
|
|
|
|
Abhijit D. Babar wrote: But now i can't send or receive the data from Toolkit which i download. My application is in VC++ and Toolkit is in Java. Is there any function i have to add in my application.
is your toolkit is Socket server or socketclient. Are you connecting on right socket port?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
After running your application at both side (server/client) check that your application able to bind on that port or not? You can use "netstat" command in window.
Parag Patel
Sr. Software Eng, Varaha Systems
|
|
|
|
|
I use netstat and Telnet also and it bind the socket. But when i try to run my client program, it will wait or stop on "connect" function.
I place the client code below, please see, where is the problem.
/// Client code ////
CString str;
int sock,iResult,iOptVal,iSenderAddrSize;
int BUFF_SIZE = 30,iError;
char recv_data[30];
char* localIP = "";
struct sockaddr_in server_addr,SenderAddr;
struct hostent * lpHostEntry;
WSADATA wsaData;
iSenderAddrSize = sizeof(SenderAddr);
iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
if (iResult != NO_ERROR)
AfxMessageBox(_T("Error at WSAStartup()\n"));
if ((sock = socket(AF_INET, SOCK_STREAM,0)) == -1)
AfxMessageBox(_T("Error at Socket"));
gethostname(localIP,56);
lpHostEntry = gethostbyname(localIP);
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(2050);
server_addr.sin_addr.s_addr = inet_addr("192.168.1.9");
iError = connect( sock, (SOCKADDR*) &server_addr, sizeof(server_addr) );
if(iError == SOCKET_ERROR){
iError = WSAGetLastError();
CString s1;
s1.Format(_T("Connect Error = %d"),iError);
AfxMessageBox(s1);
exit(1);
}
while(1){
memset(recv_data,0,sizeof(recv_data));
int iResult = recv(sock,recv_data,BUFF_SIZE,0) ;
if(iResult > 0)
{
recv_data[BUFF_SIZE] = '\0';
str = inet_ntoa(SenderAddr.sin_addr);
AfxMessageBox(str);
}
else{
iError = WSAGetLastError();
}
}
////////
When i run my Server program, it will stop or wait on "accept" function.
//// Server code /////
int sock, connected, bytes_recieved ;
char send_data [1024] , recv_data[1024];
CString str,s;
struct sockaddr_in server_addr,client_addr;
int sin_size;
int iResult;
WSADATA wsaData;
iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
if (iResult != NO_ERROR)
AfxMessageBox(_T("Error at WSAStartup()\n"));
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
AfxMessageBox(_T("Socket"));
exit(1);
}
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(2050);
server_addr.sin_addr.s_addr = INADDR_ANY;
//bzero(&(server_addr.sin_zero),8);
if (bind(sock, (struct sockaddr *)&server_addr, sizeof(struct sockaddr))== -1)
{
AfxMessageBox(_T("Unable to bind"));
exit(1);
}
iResult = listen(sock, 1);
if(iResult == SOCKET_ERROR){
AfxMessageBox(_T("Listen"));
iResult = WSAGetLastError();
exit(1);
}
while(1)
{
sin_size = sizeof(struct sockaddr_in);
connected = accept(sock, (struct sockaddr *)&client_addr,&sin_size);
if(connected == INVALID_SOCKET ){
AfxMessageBox(_T("Invalid socket"));
}
CString strIPAddress;
strIPAddress = inet_ntoa(client_addr.sin_addr);
str.Format(_T("\n get a connection from (%s , %d)"),strIPAddress,ntohs(client_addr.sin_port));
char *sendbuf = "CMS";
while(1)
{
iResult = send(connected, sendbuf, (int)strlen(sendbuf), 0 );
if(iResult == SOCKET_ERROR){
iResult = WSAGetLastError();
s.Format(_T("send Error= %d"),iResult);
AfxMessageBox(s);
}
if(iResult > 1) {
s.Format(_T("String Length = %d"),iResult);
AfxMessageBox(s);
}
}
}
please reply....
|
|
|
|
|
Hey man, code is working, i have tested it.
I think something else in your application which is causing issue.
Just cross check below basic things
1. Message box not going background, and thats why you are feeling that program is stuck.
2. You have given right IP at client side.
Parag Patel
Sr. Software Eng, Varaha Systems
|
|
|
|
|
Hi,
May i know whther is it possible to use UrldownloadToFile in batch file...if yes pls let me know...
|
|
|
|
|
I don't think so. However, you can use the API in an executable and run the executable from a batch file (command line parameters to control it, may be).
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
What does mean to use UrldownloadToFile in batch file?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Yes, if you write a exe which uses the call.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
yes you can, if you know how to load the dll and invote the api from it in bacth file.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Have you tried RunDll32.exe?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi All
I have a problem to get information of connected USB Device.I am useing
OnMyDeviceChange(WPARAM wParam, LPARAM lParam); function which is provide me all information.But when USB Device is connected all ready and my application is start after connecteion of USB Device then i havn't found any information of USB Device.Can any one give me advice to how to get connected USB Device information.Plz help me
|
|
|
|
|
1.You must use RegisterDeviceNotification() to let system notify you application.
2.Add message handler for WM_DEVICECHANGE .
|
|
|
|
|
i am useing both RegisterDeviceNotification and WM_DEVICECHANGE.And i am getting information when my application is running and USB Device is connect.But When my application is not running and USB drive is connected and my application is start after connection of USB Device then information is not showing.But USb Device is still connected.
So problem is that how to get information allready connection of USB Device.Plz help me
|
|
|
|
|
|