|
add the .lib path to : Project / Properties / Linker / Input . Additional Dependencies.
|
|
|
|
|
sharanu wrote: I am new Visual studio 2006...
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Don't tell me you didnn't get it. He is the new Visual Studio, David.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Actually it is rather old: they forgot to put it on the market before and now it's a special bargain.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
I have to extract a few character from CString.
My CString is like this...
Here i have to get the number of Lbl..I mean 10.
My code is
CString sTemp = {"Tag-10,OnOff-19,Switch-5,Lbl-10,Signal-22,trip-1"};
int pos = sTemp.Find("Lbl-");
Here i get the pos value as 25,then i want to get the character after Lbl- (ie) 10.
How can i get ?Pls help me.
Anu
|
|
|
|
|
|
is this useful,
CString sTemp = _T("Tag-10,OnOff-19,Switch-5,Lbl-10,Signal-22,trip-1");
int pos = sTemp.Find(_T("Lbl")) + 3;
CString resToken;
resToken = sTemp.Tokenize(_T("- ,"),pos);
if (resToken != "")
{
int num = _ttoi(resToken);
};
|
|
|
|
|
That goes against OP title.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
modified on Tuesday, February 05, 2008 8:41:55 AM
|
|
|
|
|
may be more, but i think it covers what it needed
|
|
|
|
|
What? No solutions that use GetBuffer()??
I am shocked and appalled.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Only for you, to keep horror alive
strok(sTemp.GetBuffer(), "Lbl-");
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Ahhh yes - the world is balanced again.
And bonus points for using the little-known strok() function hehe
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Use CString::Mid() , as NishantB++ already said to you.
CString str = _T("Tag-10,OnOff-19,Switch-5,Lbl-10,Signal-22,trip-1");
AfxMessageBox(str.Mid(str.Find(_T("Lbl-"))+4,2));
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: 4 and 2 may vary!
I agree with 4 as he knows and is going to search using that string but if he knows 2 that means he already has the string with him and question is to find that string.
Anu_Bala wrote: Here i have to get the number of Lbl..I mean 10.
|
|
|
|
|
Apparently, you did not read the entire comment, did you? It's also mentioned "Depends on your string".
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
then the solution is if he want to find the number of Lbl, when it is 100, he want to build again
Rajesh R Subramanian wrote: "Depends on your string".
Depends on the string, lbl10.exe, lbl110.exe ...
|
|
|
|
|
My mentioning "Depends on your string" states that he'd have to modify the code accordingly if the parameters change, so that it works always without having to rebuild. I thought it was pretty clear and anyone who fails to understand is just plainly dumb.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: to modify the code accordingly if the parameters change
that is 2 to 3 when lbl is 100 that means he knows the length of string without the string i got.
lbl10.exe no rebuild , lbl-100.exe no rebuild ...
thanks
recalling ur mentioning of "Depends on your string"
Rajesh R Subramanian wrote: //4 and 2 may vary! Depends on your string.
Rajesh R Subramanian wrote: plainly dumb.
if he is such a person, i think he never post this, don't u even think, he is in need of this plain dumb solution of counting exercise, as he has NiShantB++ post already.
modified on Wednesday, February 06, 2008 11:30:57 PM
|
|
|
|
|
Hi,
I am using the DhcpRequestParams() API to retrieve the server option IDs from the DHCP server. I get the correct option values for the first time. If I make any changes to the server option IDs, and then again call the same API, it retrieves the old option values and not the changed new value. Any idea how I could retrieve the new values?
Thanks in advance,
AJ
|
|
|
|
|
Ajay L D wrote: If I make any changes to the server option IDs, and then again call the same API, it retrieves the old option values and not the changed new value. Any idea how I could retrieve the new values?
How are you calling it?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello
I have a problem on how to hide an application running in hidden mode. I found a code to hide the window. This code will hide all windows including the dos window. The code is :-
<br />
#include <windows.h><br />
<br />
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)<br />
{<br />
while(1)<br />
{<br />
Sleep(1000);<br />
}<br />
<br />
return 0;<br />
}<br />
<br />
main()<br />
{ <br />
<br />
}<br />
<br />
</windows.h>
Im not sure what does this code do but since i already test the code, it really hides the dos window.
A brief about my system, i created client server based application using a win32 console application where the client will communicate and send messages to the server. The network part has already be done and the client currently can send messages to the server meanwhile the server has no problem to display the sent messages from the client. So this means that the client-server part has no problem. One of the requirement of my application is that the client application must be hidden from the user. So, I used the code above to hide the dos window from being seen by the user. At first, the code above didnt work (the dos window can still be seen). There was no error but after i had done some research, i realize that it couldn't work because the linker setting of the project under system tab is by default set to Console (/SUBSYSTEM:CONSOLE). So i changed this setting to Windows (/SUBSYSTEM:WINDOWS). Then after i change these settings, the code above works (the dos window is hidden). How did i know that the code works is because i checked the Windows Task Manager and i saw that under processes tab, there is my *.exe is executing. The problem is that the network part didnt work since the server didnt receive any messages from the client.
Then i differentiate the application running under Windows (/SUBSYSTEM:WINDOWS) with the one running under Console (/SUBSYSTEM:CONSOLE). I realize that when the application is running under /subsystem:windows and it is hidden, the windows task manager will display only at the processes running. For instance: my project name is hidden.exe. So, hidden.exe will be displayed only at the Processes running tab. There is no display under the Application running tab. But when i change to /subsystem:console and the dos window can be seen by user, i found that the windows task manager will display hidden.exe at the Application tab meanwhile at the Processes tab, it only display cmd.exe is running, not hidden.exe.
Im not sure is this the correct method to hide a window from users view. My priority is that the client application running under dos window cannot be seen by the user which means it is hidden and at the same time, the client which is hidden is sending messages to the server and the user doesnt know that the client application is sending messages to the server. Is there any opinion or help? I really appreciate for any help or opinion. Thanks
|
|
|
|
|
if /SUBSYSTEM is console, that is console application, by default system provides a console, i am not sure whether it can be disabled, In linux, for console applications, console is not visible until an console IO statement is executed.
In your sample, main() is not going to execute in (/SUBSYSTEM:WINDOWS) and WinMain is not going to execute in (/SUBSYSTEM:CONSOLE).
However since in (/SUBSYSTEM:WINDOWS) application, since u r not creating any windows, it seems the application is hidden.
1)If you want any user interface and want to hide whenever possible, go for windows application and use ShowWindow() API to hide.
If you never want to have an user interface in this application,
2) still u can use windows application with no window created or
3) go for "Windows Service Application", Windows Service application is usually meant for background and long run task.
|
|
|
|
|
Ok. understand now. So, since i dont want any windows interface for this application, I would like to choose either option 2 or 3. (Use windows application with no window created or go for windows service application"
Let say if i choose option 2. How can i create windows application without affecting my network application (client/server) which has been coded in C. Must i use MFC or there are other options which is much more easier to use to create windows application and it can also integrate my client/server application in C.
If i choose option 3, does windows service application accepts C as the programming platform? Can it be coded in Microsoft Visual Studio or it uses another programming application. Another thing, must i change the whole code of my client/server or i can use the previous one, just change the platform from visual studio to windows service application. Actually im kinda new to programming so im weak in choosing the requirements.
Lastly, thank you from your previous reply and it really helps. Thanks again
|
|
|
|
|
First of all, it seems you need to be familiar with basics of windows programming, that can answer almost everything yourself in this context.
Kogee San wrote: Must i use MFC or there are ...
since u don't need UI, u can avoid MFC for now. Infact u can integrate your C Code with both MFC and WIN32.
Kogee San wrote: If i choose option 3, ...
WIN32, Win Service application can be implemented in VC, VC is C + Microsoft specifics
there should be more than these 3 option to do this, it depends on the level of expertise in windows programming i can rate myself (1/10)
|
|
|
|
|
Kogee San wrote: Im not sure what does this code do...
If the code snippet is troubling you, it's obvious you need to start with the very basics, and leave window hiding for another time.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|