|
Okey, te sintax of Find is.
int Find(LPCTSTR str)
int Find(TCHAR ch)
Or
int Find(LPTSTR str, int nStart)
int Find(TCHAR ch, int nStart)
In the first two sintaxs Find search from the biginning.
In the Second two sintaxs Find search from the start position.
The Find always returns the position where found the first substring or character. if don't found the substring or character returns -1.
An Example:
CString str = _T("");
str = " Text to Search";
nPos = str.Find(32); //This search for the first " "
while(nPos != -1)
{
nPos = str.Find(32, nPos + 1);
}
This example will found the character 32 in the position 0, 5 and 8.
Carlos Antollini.
|
|
|
|
|
Carlos Antollini did a great job in answering this, I think. The one thing that may not have been very
clear from his answer and example is that the 32 he used in the .Find(32) call is the ASCII code for
the "spacebar" character.
You probably figured that out, but it wasn't entirely clear from what Carlos wrote.
Other than that, I think he answered your question really well.
|
|
|
|
|
Hi,
I am now programming for Exchange Server by means of ADSI 2.5 using Visual
C++. Now I want set the property "dialin permission" using ADsRAS for Win
NT account. Anybody know how to code using VC(I can do it using VB)?
many thanx.
jingang
|
|
|
|
|
Hi,
I am now programming for Exchange Server by means of ADSI 2.5 using Visual
C++. Now I want set the property "dialin permission" using ADsRAS for Win
NT account. Anybody know how to code using VC(I can do it using VB)?
many thanx.
jingang
|
|
|
|
|
I am looking for a way to convert a date/time to a string and then back.
For instance, I have a COM component and when you call the Generate function I want it to return a string representing the current date and time.
Then you pass the date/time string returned by Generate to a Verify function later it compares this string to the current date/time and returns false if the difference is more than say 3600 seconds.
Can anyone tell me how to do this? It's an ATL component but I would rather not use MFC... Thanks in advance.
William
|
|
|
|
|
When I do m_lsCis.AddString("Whatever"); (m_lsCis being a valid list box member variable ) in my onInitDialog() it throws an assertion error. I was wondering if this is because while my onInitDialog() function is running the list box still isn't visible. Do I have to populate the list boxes after OnInitDialoge()? If so, where?
|
|
|
|
|
You need to call CDialog::OnInitDialog first. Before this call, your member variable is not associated with HWND.
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_lsCis.AddString("Whatever");
return TRUE;
}
Tomasz Sowinski
http://www.shooltz.com.pl
|
|
|
|
|
Hi,
Is it possible to start/stop the Dial-Up Server process automatically.
I have used the RAS functions to create a service that connects to a running Dial-Up server, but is it possible to use these functions to start/stop the actuall server.
The registry key:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\RemoteAccess\CallAccess changes when the Dial-Up Server is started manually if this is of any use!!.
Thanks.
Joe.
|
|
|
|
|
Does anyone know the LF character (or whatever is used to signify a newline in a MAC format text file)?
I'm trying to convert a text file from MAC format to DOS format, and I was under the impression MAC format was the same as UNIX format with just a LF, but this doesn't seem to be the case.
Cheers,
Peter Pearson
|
|
|
|
|
Just found it.
MAC: CR
UNIX: LF
DOS: CRLF
Cheers,
Peter
|
|
|
|
|
<<< In the name of GOD >>>
Hi all.
In my program i used of MCI functions, also i make HWND hMCIWnd; in member variable ...
I used of MCI functions in two functions:
HWND hMCIWnd; // IS MEMBER VARIABLE
.
.
.
void CEditorDlg::PlayDialog()
{
hWndMCI = MCIWndCreate(m_hWnd, AfxGetInstanceHandle(), MCIWNDF_SHOWNAME | WS_VISIBLE, szFilePath);
MCIWndOpen(hWndMCI, szFilePath, NULL);
MCIWndPlay(hWndMCI);
}
.
.
.
void CEditorDlg::DestroyDialog()
{
MCIWndClose(hMCIWnd);
MCIWndDestroy(hMCIWnd);
}
I haven't any problem in playing music and movie, but when my program is terminate, windows show error message to me and must close the program, so i think that this problem is for HWND hMCIWnd;, What is your comment ?
Please tell me.
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I have a big problem, I need to build my little project with the MFC dll's statically linked, but the executable that I get is about 2Mb!!
I think that not all the functions that are in the MFC dll's are used by my application, so the question is: There is any way to link my project generating a smaller exe, and without dll dependencies?
All suggestions will be welcome
Thanks
|
|
|
|
|
That is awfully big for a little project. If you have any bitmaps or anything in the resources, those go into the final executable also.
Sounds like that is the problem.
Wayne
|
|
|
|
|
There is nothing big in the resources. The guilty of the size of the file are the MFC dll's that are statically linked. (note that the exe with the dll's dinamically linked is only 40kb). but the problem is that I need to generate a small exe with no dll dependencies.
|
|
|
|
|
An App Wizard generated dialog based application with MFC statically linked only produces an exe of 192 KB in Release mode, but in Debug mode it is around 2049 KB. I suggest you go back and make sure that you are building your executable in release mode.
Chris
|
|
|
|
|
really it is, now the project is only 140k!!! Thank you very much for the help. I didn't know what is the diference between debug mode and relase mode, and I can see now that is very important for the size of the executable. Thanks again, and nice coding!!
|
|
|
|
|
Chris just stole my thunder. I was going to suggest that there is almost no way a small project should be that big since the MFC DLL is only ~900kb. You must be in debug mode.
Wayne
|
|
|
|
|
really it is, now the project is only 140k!!! Thank you very much for the help. I didn't know what is the diference between debug mode and relase mode, and I can see now that is very important for the size of the executable. Thanks again, and nice coding!!
|
|
|
|
|
HI folks,
I used to programm a lot using MFC but quite a lot people told me that this would not
be such good for the performance of programs as writing just using the WinApi an they
also said for MFC the user needs to have certain Dlls that might be unavaiable and my
programs might not work.
So I tried to start programming direct WINAPI but it seems to me MS did nearly explain
nothing in their msdn documantadion.And I noticed manny function such as the AddString-
method of the CListBox were missing. Right now I'm searching a way to comunicate with
things like Listboxes,Buttons and Edits which I succeded to add to my window.
Does anybody knows a good adress to find information about programming in the Winapi
or can give me a clue how to solute my comunication-with-my-windowitems-problme ?
I would be glad about every Help
THanks a lot for every answer
Have a nice Day Alexander
|
|
|
|
|
Why just not bind statically to the MFC lib in your release build, then you don't have to worry about the MFC dll when you distribute.
|
|
|
|
|
There are many books dealing with this subject. Probably the best is "Programmin Windows" by Charles Peltzoid ( spelling might be wrong on last name ).
In WinAPI programming, windows talk to each other via the SendMessage or PostMessage functions. So what MFC does is just wrap this call in a class function.
--------------------------------------------------------------------------
In MFC:
extern CListBox lb;
lb.AddString( _T("Some String") );
--------------------------------------------------------------------------
In WinAPI
extern HWND hwndLB;
SendMessage( hwndLB, LB_ADDSTRING, 0, _T("Some String") );
--------------------------------------------------------------------------
Both code excerpts do the same thing.
Hope that helps.
Wayne
|
|
|
|
|
I'm not sure but checkout:
http://www.wotsit.org/
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I have a configuration file that gets really big plus the memory needed is very high to load, use, and save file.
I know i can open a file w/out losing the data I had before when opening a file using the modeCreate bit on.
then I can overwrite data using seek() and the Write() or WriteString() for example.. (note I use C/C++(//) comments even on the lines of my file.)
//Load State
This is a very boring file.
//Load State
//Save State// file size not changed
This is *******boring file.]// Overwritten "a very " w/ "*******"
//Save State
Now I want to use overwriting and inserting of data in my configuration file.
Here is what I tied...
//Load State
....
[section ref]
48
[section ref]
23
....
//Load State
//Save State// file size not changed
....
[section ref]
23458ection ref]// Overwritten 48 but also Overwritten '\n' and "se" of the next line
16457
....
//Save State
So what I need is a memory saving function to extend the file x bytes and move all the following data down x bytes.
Here is what I need...
//Load State
....
[section ref]
48
[section ref]
23
....
//Load State
//Save State// file size will hope to be changed
....
[section ref]
23458// Overwritten 48 and added 3 bytes and pushed the down 3 bytes and extended the file 3 bytes
[section ref]
16457
....
//Save State
Thank you for your time.
I hope everyone can understand what I am getting at.
|
|
|
|
|
1) Open the existing file.
2) Open a new file.
3) Read the data to the point of insertion, writing this to the new file.
4) Write the new data to the new file.
5) Read the rest of the data to the end of the file, writing this to the new file.
6) Close old file.
7) Close new file.
8) Delete old file.
9) Rename new file to old file.
Hope that helps.
Wayne
|
|
|
|
|
I know this would work but the configuration file can get very big is save alot I am looking at file access proformance at this time.
|
|
|
|