|
|
Are you sure we should do #import for tapi32.lib? I thought #import is for type libraries or something to do with COM components. I haven't used TAPI myself so I am just curious.
-Saurabh
|
|
|
|
|
|
If you dont know such basic things then I would recommend stop coding right now. Buy a good book on VC++ read it first.
-Saurabh
|
|
|
|
|
ok thanks , what is the author name for good vc++ book
k.guru moorthy
|
|
|
|
|
yaiii,
i am asking seriously ,otherwise do u have written good book on VC++
. tell me
k.guru moorthy
|
|
|
|
|
|
|
It seems that you need to import lib file.
|
|
|
|
|
Dear All,
I want to know that how an "Exe" was started. That is whether the exe is launched by "Double clicking It" or "Using
right click Menu and Select Run" or "From Command Prompt" or "Invoking From Other Process"
Is there is any way in VC++ MFC to know this Exe launching details?
Expecting your valuable answers.
Thanks in advance.
Regards,
R Hariharan
Hariharan R
|
|
|
|
|
I am not sure if windows stores such information for each process. If you want you can get the command line with which the process was run. Just out of curiosity why do you need this information?
-Saurabh
|
|
|
|
|
Thanks.
I am developing an dialog Based MFC application whic has two mode of operation. One is Configuration mode another one is Execution mode. Configuration mode is used by the Administrator where as Execution mode is used in the client. In configuration mode user admin is shown with configuration dialog but in execution mode the exe will run as a background process so the client user will not be provided with any interface.
In Configuration mode the admin has to explicitly run the exe by "Double click/ Right click and select ". But in execution mode exe will be invoked from the scheduler.
So if i know the Startup mode of an exe i can able to launch the application according to that. That is if the start up mode is "double click on exe " i will run the exe in configuration mode and show the dialog to the admin. If the startup mode is "Invoking from other process" then i will just run the exe as a background process.
Hope u might have understood my requirement.
Now pls tell me how can i go about it? Or tell me some other method in which i can meet my requirement.
Thanks in advance.
Hariharan R
|
|
|
|
|
Use command line parameters:
myprogram.exe -config run the program in comfiguration mode.
myprogram.exe -background runs the program as a background process.
or if you prefer
myprogram.exe -> run the program in configuration mode.
myprogram.exe -background -> runs the program as a background process.
This way when user double clicks program automatically runs in configuration mode.
-Saurabh
|
|
|
|
|
Thats looking Good.
I was worrying about if the client got the exe and double click it it will run in the configuration mode. But the client is not suppose to do that.
Pls let me know is there is any other method apart from file/command line operation.
If nothing works out i will go with ur command line method.
Thanks Saurabh
Hariharan R
|
|
|
|
|
You can achieve this with command line as well.
myprogram.exe -configuration -> run in configuration mode.
myprogram.exe -background -> run in background mode.
myprogram.exe -> report an error to user that program should not be run manually.
If you really really want to hide the details then try this. Create 3 executables.
1. client.exe
2. service.exe
3. configuration.exe
client.exe is the application you have written. It accepts following 2 command line parameters.
client.exe -somename1 -> configuration.
client.exe -somename2 -> background.
somenameX can be anything you want to obscure the parameters.
when run without the parameters client.exe reports an error that it should not be run manually.
service.exe using ShellExecute runs client.exe with -somename2.
configuration.exe using ShellExecute runs client.exe with -somename1.
So this way no one know the paramters except you. Bottom line is command line parameters are quite powerful and you can achieve whatever you want to do. Just have to think what exactly is you need.
-Saurabh
|
|
|
|
|
Will work around the solution and get back to if any help required.
Thanks Saurabh.
Hariharan R
|
|
|
|
|
I want to capture area where pen draw area on screen.It is easy to capture the desktop,windows,or rectangle area,but how to capture the area where pen draw and copy it to the clipboard?
I know a sofeware called Snippy can do what I want .
Thanks for your advice or method!
|
|
|
|
|
I am not sure if you want to be able to copy it to the clipboard, but I remember there were two functions which might help. See CDC::BeginPath() and CDC::EndPath().
|
|
|
|
|
Hi all,
I came across this quiz the other day. It goes something like: you have a string "aabbccddeffghijk" and you should find the foremost occurrence of an unique character in the string, so in this case letter 'e' should be the answer, and this should be done in just one traversing. The tip is that array index should be of interest.
I only came up with a single traversing that can only sorts out all the letters that occurred only once in the string, but how can I tell the sequence of those single occurrence of letters within single traversing, or is this possible practically:
int ar[26] = {0};
TCHAR* ptsz = "aabbccddeffghijk";
int nIndex = 0;
while (*(ptsz++))
{
nIndex = int(*ptsz) - 'a';
ar[nIndex]++;
}
Thanks,
modified on Tuesday, July 1, 2008 10:54 PM
|
|
|
|
|
LiYS wrote: you should find the first occurrence of a character that also appeared foremost in the string
This is a confusing statement. I assume you mean you need to find the first unique character in the string?
Steve
|
|
|
|
|
Sorry, it is confusing I should have corrected it.
it should be "you should find the foremost occurrence of an unique character in the string"
|
|
|
|
|
Hi,
why store the occurence count in an array, instead store the first position using two special
values, say -1 for never seen yet, and -2 for seen multiple times.
you would have to traverse your array to initialize it, traverse the string once, then traverse
the array again to find the lowest value >=0.
BTW IMO this belongs in the algo forum, not the C++ one.
|
|
|
|
|
I notice that the string is sorted. Is the algorithm permitted to assume this? If so the the following will do the trick:
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
const char *pstr = "aabbccddeffghijk";
for (unsigned int i=1; pstr[i]!=0; ++i)
{
if (pstr[i]!=pstr[i-1] && pstr[i]!=pstr[i+1])
{
cout << "First unique character: " << pstr[i] << endl;
return 0;
}
}
cout << "No unique characters." << endl;
return 0;
}
Steve
|
|
|
|
|
The only thing I see wrong with your approach is that you are incrementing ptsz prematurely.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
As has been pointed out, the array is sorted. If that's true, and not just a coincidence...
(This assumes a /0 terminated string)
TCHAR findfirstuniquechar_sorted (TCHAR *sz)
{
if (!sz) return 0;
for (int n = 0; sz [n]; n++)
{
if (sz [n] == sz [n+1])
continue;
if ( (n > 0) && (sz [n] == sz [n-1]))
continue;
return sz [n];
}
return 0;
}
If the string is not sorted, the problem becomes harder. As you use TCHAR, I'm assuming unicode, so you can't just have a 26 array for placement...
TCHAR findfirstuniquechar_unsorted (TCHAR *sz)
{
if (!sz)
return 0;
; This line posts badly - it should be CMap less than TCHAR, TCHAR and, int, int and greater-then CharMap; hope that made sense... pre bug reported.
CMap<TCHAR, TCHAR &, int, int &> CharMap;
int nPos;
int nCharPos;
for (nPos = 0; sz [nPos]; nPos++)
{
if (CharMap.Lookup (sz [nPos], nCharPos))
{
CharMap [sz[nPos]] = -1;
}
else
{
CharMap [sz[nPos]] = nPos;
}
}
POSITION pos = CharMap.GetStartPosition ();
nPos = -1;
TCHAR c, cFirst = 0;
while (pos)
{
CharMap.GetNextAssoc (pos, c, nCharPos);
if (nCharPos < 0)
continue;
if ( (nPos == -1) || (nCharPos < nPos))
{
cFirst = c;
nPos = nCharPos;
}
}
return cFirst;
}
OK, I've just spent FAR too much time on that. I hope it wasn't homework!
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|