|
AfxGetApp()->GetMainWnd()->SetWindowText("Your Caption");
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
Hi freinds,
Now I have following questions
1) How to enumerate user's login names from active directory?
2) How to enumerate groups from active directory?
3) Is there any way to find out user-group association from active directory?
Can u pleaes guide me for above quests?
-- modified at 4:22 Monday 12th June, 2006
|
|
|
|
|
|
Hi guys
Lets say i have a file with some text in it that the words are seperated with more than one space in between
ex. This___________is_______writen______in____a_file____assume______that__underscores____
are________spaces_____how___can_i___remove____them?
i want to store this in a string but in this form:
This is writen in a file assume that underscores are spaces how can i remove them?
any ideas i tried some things but nothing works
thank u in advance
|
|
|
|
|
In MFC, I think you can read the file in line-by-line manner using CStdioFile class, and then reduce the number of spaces using multiple calls to Replace member of CString class:
while(s.Replace("__", "_") != 0);
Next, you can write strings to a new file. If you need to store them in the same file, then remove the old file and rename the new one.
-- modified at 4:05 Monday 12th June, 2006
|
|
|
|
|
Thanks for the reply Viorel
I'm not using MFC so is it possible to use the functions that u mention.
also using
while(s.Replace(" ", " ") != 0);//i'm going to loose all spaces i need to leave only one.
thanks again Viorel
|
|
|
|
|
|
Hey Sarath thanks for the reply
can i ask u a couple of questions on strtok?
the link u gave me has an example of using strtok
char string[] = "A string\tof ,,tokens\nand some more tokens";
char seps[] = " ,\t\n";
char *token;
can i use a string instead of char string[]?
also can i put any number of deliminars in seps?
thanks a lot for the help
|
|
|
|
|
|
use <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcstdlib/html/vclrf_string_basicstringreplace.asp" rel="nofollow">std::string::replace()</a>[<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcstdlib/html/vclrf_string_basicstringreplace.asp" target="_blank" rel="nofollow" title="New Window">^</a>] instead...
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
|
If you do not use MFC, you can use STL. You can read the file using a stream object like ifstream , store strings in string object, and use find function to find a sequence consisting of two spaces. Then use find_first_not_of to find the end of sequence, and call erase to remove unneeded sequences.
If you do not use STL, you can use library functions: fgets to get strings, strstr or strchr to find spaces, and so on.
If you need to do this manually, you can open the file in Notepad and use Replace command
antonaras wrote: i'm going to loose all spaces i need to leave only one.
The first parameter of Replace contains two spaces, and the second one -- a single space, so any sequence of more then one spaces will be replaced with only one (maybe not so fast as possible). For convenience, I modified the sample using underscores.
|
|
|
|
|
Thanks Viorel your answer is very clear and helpful
appriciate all the help
|
|
|
|
|
Viorel. wrote: while(s.Replace("__", "_") != 0);
The loop is not required.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I think the loop is required. Otherwise, in case of three consecutive spaces, only first two ones will be replaced with one space, and we will obtain two spaces in the result. Therefore we have to repeat the replace operation.
It is possible to avoid loop and improve performance using other approaches.
|
|
|
|
|
Viorel. wrote: I think the loop is required.
You're right. I spoke prematurely. Sorry about that.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi!
This might be really basic question but nevertheless I need some help
My problem is that I want a button to send two separate messages depending on if it is being clicked or released (Button down and button up) with the mouse pointer.
I am using an Visual C++ dialoge application created using the wizard.
I just can't figure out how to do it with the CButton class, or if it is even possible.
Does anyone have any input on this? I would really appreciate some kick-start help here!
Thanks,
Larssen
|
|
|
|
|
Create a class derived from CButton say CMyButton.
Now in that class override the OnLButtonDown and OnLButtonUp events.
Include the file MyButton.h in the class where you are using the button.
Add a variable to the button.(call it m_btn)
Open the header file of the dialog and change CButton to CMyButton
You are done with this
You can test the code by putting message boxes in the button class you created.
To test the LButtonUP functionality click anywhere in the dialog and take the mouse on the button with LButton Pressed. Release the Mouse button on the button on the dialog.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
See Here[^] maybe it is some helpful to you
whitesky
|
|
|
|
|
Hello everyone,
I am going to add some source files (.c, .cpp and .h) to a project in Microsoft embedded VC++ 4.0. There are a lot of source files and they are organized in their source tree file structure. I am wondering what is the most convenient way to add them all to an embedded VC++ project. Currently, I have to add them one by one (by "Add files to project" context menu of a project), which will break original source tree structure (which adds all the source files to "Source Files" folder in FileView).
thanks in advance,
George
|
|
|
|
|
Hi,
I need to create a modeless dialog with minimise and maximize button in win32 application .( so what have to set in sytle attribute in the dialog template ....
Manjunath S
|
|
|
|
|
|
Dears Sir,
Every time when I change Pc or when Réinstall pc i have a difficult with my program source.
Before changing pc I have copied all the directory of my program, after changing I reload it on my pc, but when I compile I have news messages that i don't have before. What to do ? These are messages:
--------------------Configuration: STOCK - Win32 Debug--------------------
Compiling...
Property.cpp
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2091: function returns function
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2809: 'operator new' has no formal parameters
c:\program files\microsoft visual studio\vc98\include\new(36) : error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\new(37) : error C2091: function returns function
c:\program files\microsoft visual studio\vc98\include\new(37) : error C2556: 'void *(__cdecl *__cdecl operator new(void))(unsigned int,const struct std::nothrow_t &)' : overloaded function differs only by return type from 'void *(__cdecl *__cdecl op
erator new(void))(unsigned int)'
c:\program files\microsoft visual studio\vc98\include\new(35) : see declaration of 'new'
c:\program files\microsoft visual studio\vc98\include\new(41) : error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\new(42) : error C2091: function returns function
c:\program files\microsoft visual studio\vc98\include\new(42) : error C2556: 'void *(__cdecl *__cdecl operator new(void))(unsigned int,void *)' : overloaded function differs only by return type from 'void *(__cdecl *__cdecl operator new(void))(unsig
ned int)'
c:\program files\microsoft visual studio\vc98\include\new(35) : see declaration of 'new'
c:\program files\microsoft visual studio\vc98\include\new(42) : error C2809: 'operator new' has no formal parameters
c:\program files\microsoft visual studio\vc98\include\new(42) : error C2065: '_P' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\memory(16) : error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\memory(17) : error C2091: function returns function
c:\program files\microsoft visual studio\vc98\include\memory(17) : error C2784: 'void *(__cdecl *__cdecl operator new(void))(unsigned int,class std::allocator<`template-parameter257'> &)' : could not deduce template argument for 'void *(__cdecl *)(u
nsigned int,class std::allocator<_Ty> &)' from 'void *(__cdecl *)(unsigned int)'
c:\program files\microsoft visual studio\vc98\include\memory(17) : error C2785: 'void *(__cdecl *__cdecl operator new(void))(unsigned int,class std::allocator<`template-parameter257'> &)' and 'void *(__cdecl *__cdecl operator new(void))(unsigned int
)' have different return types
c:\program files\microsoft visual studio\vc98\include\memory(16) : see declaration of 'new'
c:\program files\microsoft visual studio\vc98\include\memory(17) : error C2809: 'operator new' has no formal parameters
c:\program files\microsoft visual studio\vc98\include\memory(20) : error C2954: template definitions cannot nest
C:\progms\STOCK\Property.cpp(1219) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
Error executing cl.exe.
STOCK.exe - 17 error(s), 1 warning(s)
I learn my self
|
|
|
|
|
My guess is you copied some code from a MFC project to a non-MFC project, and the MFC code redefines new to DEBUG_NEW to get some MFC memory-tracking features. Remove the redefinition.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|