|
Try it:
ShellExecute(NULL,"open","a.wav",NULL,"C:\\MyFolder",SW_SHOWNORMAL);
or
ShellExecute(NULL,"open","C:\\MyFolder\\a.wav",NULL,NULL,SW_SHOWNORMAL);
|
|
|
|
|
It is working fine... Thank you all...
-Ravi
|
|
|
|
|
|
can anyone help me.
i need to change the attribute of a folder. i need to deny the write access of the computer administrator of a certain folder. can anyone help me.
if you need further inputs. please do notify me...
thanks...
regards...
"a man is not judged by his looks but by the way he acts..."
moodsey211
|
|
|
|
|
My dialog have a button and I had edit the code like below:
typedef struct
{
SOCKET Skt;
SOCKADDR_IN AddrFrom;
int nAddrFromLen;
LPVOID ParamPointer;
}SOCKETDATA;
SOCKET ServerSkt;
void CTCPTestDlg::OnBtnstart(LPVOID lParam)
{
// TODO: Add your control notification handler code here
char szMessage[300];
wsprintf(szMessage, "(ListenThread) - Starting TCP/IP Initialisations.");
// WriteSysLog(szMessage);
ServerSkt = socket ( AF_INET, SOCK_STREAM, 0 );
if ( ServerSkt == INVALID_SOCKET )
{
//wsprintf(szMessage, "(ListenThread) - socket() Error. Unable to Create Server Socket.");
//WriteSysLog(szMessage);
printf("Error!");
}
else
{
SktAddr.sin_family=AF_INET;
SktAddr.sin_port=htons(ReadPortNo("[TCP.FLDATA.SRV.COMMUNICATION]"));
SktAddr.sin_addr.s_addr=htonl(INADDR_ANY);
if ( bind ( ServerSkt, ( LPSOCKADDR ) &SktAddr, sizeof ( SktAddr ) ) == SOCKET_ERROR )
{
//wsprintf(szMessage, "(ListenThread) - bind() Error. Server Socket Binding Failure.");
//WriteSysLog(szMessage);
printf("Error!");
}
else
{
wsprintf(szMessage, "(ListenThread) - TCP/IP Socket Binding Completed Successfully.");
WriteSysLog(szMessage);
if ( listen ( ServerSkt, SOMAXCONN ) == SOCKET_ERROR )
{
//wsprintf(szMessage, "(ListenThread) - listen() Error. Server Socket Unable to Listen for Connections.");
//WriteSysLog(szMessage);
printf("Error!");
}
else
{
wsprintf(szMessage, "(ListenThread) - TCP/IP Listening Stage Completed Successfully.");
WriteSysLog(szMessage);
hThread=AfxBeginThread (AcceptThread,lParam,THREAD_PRIORITY_NORMAL);
if ( hThread == NULL )
{
//wsprintf(szMessage, "(ListenThread) - AfxBeginThread() Error. Unable to Create AcceptThread() Thread.");
//WriteSysLog(szMessage);
printf("Error!");
}
else
{
wsprintf(szMessage, "(ListenThread) - AcceptThread() Thread Spinoff Completed Successfully.");
WriteSysLog(szMessage);
return 0;
}
}
}
}
return 0;
}
After I compile, it have 9 errors occur as below:
error C2146: syntax error : missing ';' before identifier 'Skt'
error C2501: 'SOCKET' : missing storage-class or type specifiers
error C2501: 'Skt' : missing storage-class or type specifiers
error C2146: syntax error : missing ';' before identifier 'AddrFrom'
error C2501: 'SOCKADDR_IN' : missing storage-class or type specifiers
error C2501: 'AddrFrom' : missing storage-class or type specifiers
error C2146: syntax error : missing ';' before identifier 'ServerSkt'
error C2501: 'SOCKET' : missing storage-class or type specifiers
fatal error C1004: unexpected end of file found
Error executing cl.exe.
I don't know how to solve it. Can somebody tell me
-- modified at 2:43 Tuesday 30th August, 2005
|
|
|
|
|
as it's already been said, you are missing a header file to include...
you must have a #include <> before using those types (they are declared somewhere ; C++ need those declarations before their use).
TOXCCT >>> GEII power [toxcct][VisualCalc]
-- modified at 2:55 Tuesday 30th August, 2005
|
|
|
|
|
did u check the braces { } properly..?
Regards,
V
|
|
|
|
|
Hi,
Can any one kindly let me know this. I have one dialog based program. In that I have different Text Boxes. In one condition I need to make some text boxes readonly. At that time if I pressed tabkey, I don't want to enter into that text box(It should be only for some situations). I could able to do readonly based on conditions, but when I press Tabkey I could not able to trap the control from that Textbox programatically. Please let me know if any one know this.
Thank you.
-Haranadh
|
|
|
|
|
manually = at runtime ? Then you have to modify the style of the control and delete the WS_TABSTOP style
m_edit.ModifyStyle(WS_TABSTOP,0);
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Consider disabling the controls (EnableWindow(FALSE) ) instead of making them read-only. Being disabled, they would be automatically skipped when navigating with the tab key. Besides, it gives a better feedback to the user because the fact that there's no way to change the data is made more evident. The only drawback is that the user won't be able to select and copy the content to the clipboard.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
OK, two more then. I have managed to fix almost all my linking problems, except two, as follows:
nafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv
nafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
Now, I've googled this message, but I've found nothing helpful, so any suggestions anyone has would be most appreciated.
Christian Graus - Microsoft MVP - C++
-- modified at 1:45 Tuesday 30th August, 2005
Wow - that's cool. The modification is as follows:
I'm building with /MT and using MFC in a static library. I found some stuff on google that says I need to use a shared library, but that's not possible, it will then not link with other libraries that I am using.
|
|
|
|
|
try including stdlib.h in the app's stdafx.h file.
|
|
|
|
|
Doesn't help, and I didn't expect it to - this is a *linking* error.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
Sadly, no. I know about this problem, it's how I solved all my other linker problems. I need to use /MT or the program won't compile at all, and I am indeed using it everywhere.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello,
I'm trying to create an application, which will be always at bottom Z order. I mean it must be behind all the windows in the desktop. My window may have buttons, edit boxes, etc.
How can I achieve this?
I think I must do all the things that the desktop window of WINDOWS do.
Thank you for valuable help.
|
|
|
|
|
::SetWindowPos has a BottomMost value, if you google SetWindowPos you will find it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thank you.
But I want to create a window that behave like the desktop window of WINDOWS. That is it must not come to top when I click on it or move or size it.
SetWindowPos will make it a bottom window, but when I click it it will become top. But the desktop window of WINDOWS will never come to top in any case.
Can you help me?
|
|
|
|
|
You can handle the click event and put it back to the bottom, apart from that I really don't know what you could do.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I suspect you'd need to handle the WM_ACTIVATE, WM_NCACTIVATE, WM_MOUSEACTIVATE messages. I don't know for certain, but I would start looking at those messages.
|
|
|
|
|
Note the desktop window is the ancestor of all windows, it can never come to the top.
You could probably override CWnd::SetWindowPos() so that the window itself has control over its own Z-order placement.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Ok to start things off i am a complete noob at programming, been trying to learn most of it myslef. Recently i made a property managment Database for the properties i own. I want to try and upgrade this program with implementing classes and Vectors. now im not sure what to do and how to transform it, i think the struct would go in the class in a .h file and the fuctions would go in the .cpp can someone please review the code below and give me a rough indercation of what to do.
----------------------------------------------------------------
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
struct propertyInfo
{
string address;
string suburb;
int price;
};
void displayProperty (propertyInfo property);
void getProperty(propertyInfo &property, int &);
void displayLibrary(propertyInfo properties[], int &);
void displayFile(propertyInfo properties[], int &);
void search(propertyInfo properties[], int &);
void saveproperty(propertyInfo properties[], int &numProperties);
int displayMenu();
const int MAXPROPERTIES = 100;
int main()
{
int numProperties = 0;
propertyInfo properties[MAXPROPERTIES];
propertyInfo property = {};
displayFile(properties, numProperties);
int choice = displayMenu();
while (choice!=0)
{
switch (choice)
{
case 1: search(properties,numProperties);
break;
case 2: saveproperty(properties, numProperties);
break;
case 3: displayLibrary(properties, numProperties);
break;
case 4: getProperty(properties[numProperties], numProperties);
break;
case 5: return 0;
}
choice = displayMenu();
}
system("pause");
return 0;
}
void getProperty(propertyInfo &property, int & numProperties)
{
cout << "\nEnter address: " ;
getline(cin, property.address);
cout << "Enter suburb: ";
getline(cin, property.suburb);
cout << "Enter price: ";
cin >> property.price;
cin.ignore();
cout <<"property: " << property.address << ", " << property.suburb << ", " << property.price << " added";
numProperties++;
}
void displayProperty (propertyInfo property)
{
cout << property.price << " " << property.address << " " << property.suburb ;
}
void displayLibrary(propertyInfo properties[], int &numProperties)
{
cout << endl;
for(int t = 0; t < numProperties; t++)
{
displayProperty(properties[t]);
cout << endl;
}
}
void displayFile(propertyInfo properties[], int &numProperties)
{
string FileName = "";
string Extension = ".txt";
cout << "Enter property filename: ";
cin >> FileName;
FileName = FileName + Extension;
//Convert the sting into a char pointer in order to pass it to open()
const char * TheFile = FileName.c_str();
ifstream fin;
fin.open(TheFile, ios::in);
if(fin.is_open())
{
while (numProperties < MAXPROPERTIES && !fin.eof())
{
getline(fin, properties[numProperties].address);
getline(fin, properties[numProperties].suburb);
fin >> properties[numProperties].price;
fin.ignore(); // ignore new line character left after reading int
numProperties++;
}
fin.close();
}
else
cout << "Could not open filename: " << FileName << endl;
}
void search(propertyInfo properties[], int &numProperties)
{
int searchamount = 0;
cout << "Enter Search amount ";
cin >> searchamount;
cout << endl;
for (int z=0; z < numProperties; z++)
{
if (properties[z].price < searchamount)
{
displayProperty(properties[z]);
cout << endl;
}
}
}
int displayMenu()
{
int choice =0;
cout << "\nMenu:\n";
cout << "1 - Property Search" <<endl;
="" cout="" <<="" "2="" -="" save="" property="" list"="" <<endl;="" "3="" list="" all="" properties"="" "4="" add="" a="" property"="" <<endl;
="" "5="" exit"=""
="" cout<<="" "enter="" menu="" choice="" ";="" cin="">> choice;
cin.ignore(1);
return choice;
}
void saveproperty(propertyInfo properties[], int &numProperties)
{
string fileName = "";
string Extension = ".txt";
cout << "Enter filename: ";
cin >> fileName;
cout << "Property details saved to the file: " << fileName <
|
|
|
|
|
Hi.
You'll probably find this program more useful in the long run if you move it to a windows app instead of a console app. As for moving it to have classes, as it stands, it only needs one, the struct you've already defined, unless you want to move data access into a class perhaps.
I'd also suggest looking into using MSDE or something similar to store your data instead of a flat text file.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
what im trying to do is get rid of the struct and turn it into a class.
|
|
|
|
|
replace
struct
{
with
class
{
public:
a class and a struct are the same thing, the only difference is that a class has private as default, and a struct has public. You can add constructors and methods to a struct, like I say, there is no real difference. Of course, if you create a class in a .h and .cpp file, then as your struct has no methods, you'd put it all in the .h file, the .cpp file would be empty except the #include of the header file. If you add methods, they would be declared in the header, and their body would be in the cpp file.
I recommend getting the build in wizards to build a class and add some methods, so you can see how it all gets laid out. Basically you put the class name and a :: before the name of the method in the .cpp file, to differentiate from global methods.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|