|
You could use the WM_COPYDATA mechanism, but you need to have the hwnd of the process you want to signal.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
i hope can someone help me in this project.....
firstly i want to know how to read a text from a file...
after that convert the text to lowercase or uppercase...
than count the probability of the word that appear in the text......
|
|
|
|
|
Reading files look at CFile
For string manipulation look at CString , it can covert to upper / lower and has Find functionality in order to match partial strings (words) within other strings (text).
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Assuming you want to use MFC:
CStdioFile file;
BOOL eof=TRUE;
CString lineOfText;
//See CFile and CStdioFile documentation in MSDN for other Open() options
file.Open("C:\\pathToYourFile\\filename.txt", CFile::modeRead);
while(eof==TRUE)
{
eof=file.ReadString(lineOfText);
lineOfText.MakeUpper();
lineOfText.MakeLower()
}
file.Close();
MS
|
|
|
|
|
Sounds like a homework assignment to me...
How about reading your textbook first?
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
The thought crossed my mind. Then I thought, the hell with it, I will point them in the right direction today! Some reading would be required however
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Given a path e.g. c:\somedir1\somedir2\file.txt how can you find out if file.txt is a directory or a file?
Can't base the judgement on the extension, since there could be a directory named file.txt.
On a side note
I have an application that is using FindFirstFile and FindNextFile to enumerate all files and subdirectories in a given path.
Now I want to check if this given path is a pointing to a file, so I could ShellExecute the file, instead of calling the above functions.
|
|
|
|
|
To check for directory you need to check the dwFileAttributes of the WIN32_FIND_DATA structure that you pass to FindFirstFile or FindNextFile
WIN32_FIND_DATA data;
...
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
...
}
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Test FindFirstFile() etc. WIN32_FIND_DATA.dwFileAttributes for FILE_ATTRIBUTE_DIRECTORY. Should do the trick.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
I am using the following code to create a named pipe
<br />
SECURITY_ATTRIBUTES saPipeSecurity = {0};<br />
PSECURITY_DESCRIPTOR pPipeSD = NULL;<br />
<br />
if(lpSecurityAttributes == NULL)<br />
{<br />
if ( ! ( pPipeSD = ( PSECURITY_DESCRIPTOR) <br />
( malloc ( SECURITY_DESCRIPTOR_MIN_LENGTH)) ) )<br />
return FALSE;<br />
<br />
if ( ! InitializeSecurityDescriptor ( pPipeSD, <br />
SECURITY_DESCRIPTOR_REVISION) )<br />
return FALSE;<br />
<br />
if ( ! SetSecurityDescriptorDacl ( pPipeSD, TRUE, ( PACL) NULL, FALSE) )<br />
return FALSE;<br />
<br />
saPipeSecurity.nLength = sizeof ( SECURITY_ATTRIBUTES);<br />
saPipeSecurity.bInheritHandle = TRUE; <br />
saPipeSecurity.lpSecurityDescriptor = pPipeSD;<br />
<br />
lpSecurityAttributes = &saPipeSecurity;<br />
}<br />
<br />
m_hPipe = ::CreateNamedPipe(pszPipeName, dwOpenMode, dwPipeMode, dwMaxInstances, <br />
dwOutBufferSize, dwInBufferSize, dwDefaultTimeOut, lpSecurityAttributes);<br />
then I use a CreateProcessWithLogonW to spawn a new process that connect to this pipe using CreateFile. The createfile fails and return last error gives 5(access denied). Can anybody guess what I am doing wrong.
|
|
|
|
|
but what kind of a value does dwOpenMode have?
Access specified when a pipe is opened (CreateFile) must be compatible with the access specified in the dwOpenMode (CreateNamedPipe).
if PIPE_ACCESS_OUTBOUND or PIPE_ACCESS_INBOUND
you must call CreateFile with
GENERIC_READ, GENERIC_WRITE accordingly as dwDesiredAccess param.
|
|
|
|
|
thanks I was able to resolve that issue...now I am facing a new issue..CreateProcessWithLogonW call is taking too much time on a WinXP machine, but work fine of a Win2000...any ideas why?
|
|
|
|
|
What is an upper limit for dynamic allocation of single array?
For an example:
int* A_of_int = new int[X];
What is upper value for X. The environment is visual studio 6 on windows platform (XP). I suppose one of the limits is memory size.
|
|
|
|
|
|
Hi
Perhaps I'm wrong but INT_MAX is defined as maximum int value 2^31-1
What I need is maximum array size for type int
Is constant INT_MAX also used to define maximum array size for type int?
Tomaz Rotovnik
|
|
|
|
|
|
I need an huge array and I want prevent application crash.
I think I found the answer:
max heap size is declared in malloc.h
/* Maximum heap request the heap manager will attempt */
#define _HEAP_MAXREQ 0xFFFFFFE0
Tomaz Rotovnik
|
|
|
|
|
Tomaz Rotovnik wrote:
#define _HEAP_MAXREQ 0xFFFFFFE0
That is 4GB, a lot more memory that most computers have...
If you use malloc to alloc your array, the app will not crash, but you will get a NULL pointer if it fails.
- Anders
Money talks, but all mine ever says is "Goodbye!"
ShotKeeper, my Photo Album / Organizer Application
[^]
My Photos[^]
|
|
|
|
|
Anders Molin wrote:
That is 4GB, a lot more memory that most computers have...
Even if the computer had 8GB of RAM, the memory manager only allows each process 2GB for its address space, or 3GB if the /3GB startup switch were used.
Anders Molin wrote:
...if it fails.
That should be "when it fails."
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi , I'm wondering if anyone can help me out with this , or steer me in the right direction.
I get these errors , when trying to compile..
--
C:\phonebook.cpp(71) : error C2593: 'operator >>' is ambiguous
C:\phonebook.cpp(72) : error C2593: 'operator <<' is ambiguous
C:\phonebook.cpp(73) : error C2593: 'operator <<' is ambiguous
--
<br />
#include iostream
#include fstream<br />
#include cstring<br />
<br />
using namespace std;<br />
<br />
class phonebook {<br />
public:<br />
char name[80];<br />
char areacode[4];<br />
char prefix[4];<br />
char num[5];<br />
phonebook() { };<br />
phonebook(char *n, char *a, char *p, char *nm)<br />
{<br />
strcpy(name,n);<br />
strcpy(areacode,a);<br />
strcpy(prefix,p);<br />
strcpy(num,nm);<br />
}<br />
friend ostream &operator<<(ostream &stream, phonebook o);<br />
friend istream &operator>>(istream &stream, phonebook &o);<br />
};<br />
<br />
ostream &operator<<(ostream &stream, phonebook o)<br />
{<br />
stream << o.name << "\t";<br />
stream << "(" << o.areacode << ") ";<br />
stream << o.prefix << "-";<br />
stream << o.num << "\n";<br />
return stream;<br />
}<br />
<br />
istream &operator>>(istream &stream, phonebook &o)<br />
{<br />
cout << "Enter name: ";<br />
stream >> o.name;<br />
cout << "Enter area code: ";<br />
stream >> o.areacode;<br />
cout << "Enter prefix: ";<br />
stream >> o.prefix;<br />
cout << "Enter number: ";<br />
stream >> o.num;<br />
cout << "\n";<br />
return stream;<br />
}<br />
<br />
bool main (void)<br />
{<br />
phonebook a;<br />
char c;<br />
fstream pb("phone", ios::in | ios::out | ios::app);<br />
<br />
if(!pb) {<br />
cout << "Cannot open phone book file.\n";<br />
return false;<br />
}<br />
<br />
for(;;) {<br />
do {<br />
cout << "1. Enter numbers\n";<br />
cout << "2. Display numbers\n";<br />
cout << "3. Quit\n";<br />
cout << "\nEnter a choice: ";<br />
cin >> c;<br />
} while(c<'1' || c>'3');<br />
<br />
switch(c) {<br />
case '1':<br />
<br />
cin >> a;<br />
cout << "Entry is: " << a;<br />
pb << a;<br />
break;<br />
<br />
case '2':<br />
<br />
char ch;<br />
pb.seekg(0, ios::beg);<br />
while(!pb.eof()) {<br />
pb.get(ch);<br />
if(!pb.eof()) cout << ch;<br />
}<br />
pb.clear();<br />
cout << endl;<br />
break;<br />
<br />
case '3':<br />
<br />
pb.close();<br />
return false;<br />
<br />
}<br />
<br />
}<br />
return true;<br />
}<br />
it seems to have trouble around here.
--
cin >> a;
cout << "Entry is: " << a;
pb << a;
--
any help ,or comments would be greatly appreciated.
Thanks..
Note: this code is originally from "The Complete Reference, C++ Fourth Edition" , a book I've been studying..
|
|
|
|
|
Include the .h files ( iostream.h etc...)
ane remove the using namespace statement.
Think it'll compile.
|
|
|
|
|
I tried to use the SetProcessDefaultLayout() fuction of the platform sdk, but the compiler couldn't find it in the winuser.h header. I opened the header myself and I found that the fuction is declared as follows:
#if(WINVER >= 0x0500)
WINUSERAPI
BOOL
WINAPI
GetProcessDefaultLayout(
OUT DWORD *pdwDefaultLayout);
WINUSERAPI
BOOL
WINAPI
SetProcessDefaultLayout(
IN DWORD dwDefaultLayout);
#endif /* WINVER >= 0x0500 */
so what does WINVER>=0x0500 mean?
also the LAYOUT_RTL default layout is not defined in the header.
can any one help please? thanks in advance
|
|
|
|
|
|
i m working on video capture using VC++ n DirectShow
i change the configuration from Debug to Release ..
than there is a list of errors: i cant find its solution plz tell me .. thanx
camDlg.obj : error LNK2001: unresolved external symbol _MEDIATYPE_Audio
camDlg.obj : error LNK2001: unresolved external symbol _MEDIATYPE_Video
camDlg.obj : error LNK2001: unresolved external symbol _TIME_FORMAT_FRAME
camDlg.obj : error LNK2001: unresolved external symbol "int __cdecl wsprintfWInternal(unsigned short *,unsigned short const *,...)" (?wsprintfWInternal@@YAHPAGPBGZZ)
camDlg.obj : error LNK2001: unresolved external symbol _TIME_FORMAT_MEDIA_TIME
camDlg.obj : error LNK2001: unresolved external symbol _IID_IMediaControl
ReportDlg.obj : error LNK2001: unresolved external symbol _IID_IMediaControl
camDlg.obj : error LNK2001: unresolved external symbol _IID_IVideoWindow
ReportDlg.obj : error LNK2001: unresolved external symbol _IID_IVideoWindow
camDlg.obj : error LNK2001: unresolved external symbol _LOOK_UPSTREAM_ONLY
camDlg.obj : error LNK2001: unresolved external symbol _IID_IAMCrossbar
camDlg.obj : error LNK2001: unresolved external symbol _PIN_CATEGORY_CAPTURE
camDlg.obj : error LNK2001: unresolved external symbol _PIN_CATEGORY_PREVIEW
camDlg.obj : error LNK2001: unresolved external symbol _MEDIATYPE_Interleaved
camDlg.obj : error LNK2001: unresolved external symbol _CLSID_NullRenderer
camDlg.obj : error LNK2001: unresolved external symbol _PIN_CATEGORY_VIDEOPORT
camDlg.obj : error LNK2001: unresolved external symbol _CLSID_CaptureGraphBuilder2
camDlg.obj : error LNK2001: unresolved external symbol "public: __thiscall CMediaType::~CMediaType(void)" (??1CMediaType@@QAE@XZ)
camDlg.obj : error LNK2001: unresolved external symbol "public: void __thiscall CMediaType::SetSubtype(struct _GUID const *)" (?SetSubtype@CMediaType@@QAEXPBU_GUID@@@Z)
camDlg.obj : error LNK2001: unresolved external symbol _MEDIASUBTYPE_RGB24
camDlg.obj : error LNK2001: unresolved external symbol "public: void __thiscall CMediaType::SetType(struct _GUID const *)" (?SetType@CMediaType@@QAEXPBU_GUID@@@Z)
camDlg.obj : error LNK2001: unresolved external symbol "public: __thiscall CMediaType::CMediaType(void)" (??0CMediaType@@QAE@XZ)
camDlg.obj : error LNK2001: unresolved external symbol _IID_IBaseFilter
camDlg.obj : error LNK2001: unresolved external symbol _CLSID_SampleGrabber
camDlg.obj : error LNK2001: unresolved external symbol _CLSID_FilterGraph
ReportDlg.obj : error LNK2001: unresolved external symbol _CLSID_FilterGraph
camDlg.obj : error LNK2001: unresolved external symbol _CLSID_VideoInputDeviceCategory
camDlg.obj : error LNK2001: unresolved external symbol _CLSID_SystemDeviceEnum
camDlg.obj : error LNK2001: unresolved external symbol _MEDIASUBTYPE_Asf
|
|
|
|
|
looks like missing .lib files in linker options
rrrado
|
|
|
|