|
>>Do I still need to close the file first?
Looks like it, unfortunately. Even ReOpenFile won't let you change the sharing mode without
closing the handle first. At least that's what I gathered from the SDK.
I'd say closing and reopening is the only way to go ... I may be wrong
Mark
|
|
|
|
|
Need to know if I can directly access elements in an STL array based on the Iterator ..
As for eg
List contains { 1,2,3,4,5,6,7,8 }
if List::Iterator iter = List.begin()
Now to access nth element can the routine be like
int GetElementAt( int index)
{
// range check
iter = List.begin();
iter+=index;
return *iter ;
}
Engineering is the effort !
|
|
|
|
|
act_x wrote: Engineering is the effort !
what happened when you tried it?
cje
|
|
|
|
|
A std::list isn't an "array" and list iterators don't support random access. Vector and deque iterators support the += operator.
|
|
|
|
|
act_x wrote: iter+=index;
try
std::advance(iter, index);
Might work
|
|
|
|
|
will
for(int i=0;i<index;i++,iter++) ;
this="" should="" work="" as="" the="" ++="" operator="" is="" supported="" for="" iterator="" ?=""
=""
<div="" class="ForumSig">Engineering is the effort !
|
|
|
|
|
yes the ++ operator should be supported for the iterator
I sugest you look at the doco
|
|
|
|
|
I created a SDI application which is containing tree control displaying FOlders and files of a System.Now i want ot add functionality drag and drop from GUI to Explorer and Explorer to GUI.When i dragged from explorer to tree, the dragged files and folders to be added where i droped(for ex: if i dropped on USB drive the respected files and folders added to USB drive)
Any ideas?
|
|
|
|
|
See DragAcceptFiles(), WM_DROPFILES, DragQueryFile(), DragFinish(), etc.
Mark
|
|
|
|
|
My tree controlis accepting files after dropping the files how can i handle it?
Meand how can i copied the dropped files to respected folder or drive
|
|
|
|
|
Im not sure do you need to DragQueryFile ?
|
|
|
|
|
Hi fellows. I created an app that have 2 menus. The code for these menus are below:
<br />
hMenu1 = CreateMenu();<br />
hMenu2 = CreateMenu();<br />
hSubMenu1 = CreateMenu();<br />
hSubMenu2 = CreateMenu();<br />
unsigned int uiParams[5];<br />
unsigned int uiNums[5];<br />
unsigned int uiSize = 5;<br />
char cNames[][256] = {"&Menu", "&Estudo Anatômico", "M&odelo com Transparência", "", "&Sair"};<br />
uiParams[0] = MF_STRING|MF_POPUP;<br />
uiParams[1] = uiParams[2] = uiParams[4] = MF_STRING;<br />
uiParams[3] = MF_SEPARATOR;<br />
uiNums[0] = 0; uiNums[1] = 1; uiNums[2] = 2; uiNums[3] = 3; uiNums[4] = 4;<br />
MenuCreator(hMenu1, hSubMenu1, uiParams, uiNums, cNames, uiSize);<br />
SetMenu(hwnd, hMenu1);<br />
DrawMenuBar(hwnd);<br />
char cNames2[][256] = {"&Controles", "&Habilitar/Desabilitar Controles"};<br />
uiParams[0] = MF_STRING|MF_POPUP; uiParams[1] = MF_STRING;<br />
uiNums[0] = 5; uiNums[1] = 6;<br />
uiSize = 2;<br />
MenuCreator(hMenu2, hSubMenu2, uiParams, uiNums, cNames2, uiSize);<br />
SetMenu(hwnd, hMenu2);<br />
I have a function that create menus dynamically. Here it is:
<br />
void MenuCreator(HMENU hParentMenu, HMENU hChildMenu, unsigned int uiBehaviors[], unsigned int uiIDItems[], char cNameItems[][256], unsigned int uiSize)<br />
{<br />
if(hParentMenu == NULL || (hParentMenu == NULL && hChildMenu != NULL))<br />
{<br />
MessageBox(NULL, "Menu pai não pode ser nulo", "Erro", MB_OK|MB_ICONERROR);<br />
return;<br />
}<br />
if(hParentMenu != NULL && hChildMenu != NULL)<br />
{<br />
for(int i = 1 ; i < uiSize ; i++)AppendMenu(hChildMenu, uiBehaviors[i], uiIDItems[i], cNameItems[i]);<br />
AppendMenu(hParentMenu, uiBehaviors[0], (unsigned int)hChildMenu, cNameItems[0]);<br />
return;<br />
}<br />
if(hParentMenu != NULL && hChildMenu == NULL)<br />
{<br />
for(int i = 0 ; i < uiSize ; i++)<br />
{<br />
AppendMenu(hChildMenu, uiBehaviors[i], uiIDItems[i], cNameItems[i]);<br />
}<br />
return;<br />
}<br />
}<br />
when I insert the first menu, works fine. When I insert the other, the first menu isn't there, just the second. What I want to do is to have 2 or more menus at the same time, like File|Edit|View.
What's going on? Thanks
|
|
|
|
|
Problem solved, I was create 2 main menus. So, when I insert the other main menu it was overlapping the other. I deleted the other main menu and add the items in only 1 main menu
|
|
|
|
|
The application must call the "DrawMenuBar" function whenever a menu changes, whether or not the menu is in a displayed window.
|
|
|
|
|
Hi I have a CSV (Comma Separated Value) file that I need to read in and put data into structures. I am going to be using MFC to have a gui to select a file and read it. I'm more interested in getting to open a csv file and parsing the data. Each like in the csv file will have around 10 items or so....
I just would like to know the syntax of how to go about doing this...
Any help would be greatly apperciated....
Thanks,
C++/MFC; Visual Studio 6.0
|
|
|
|
|
arunkk1 wrote: CSV (Comma Separated Value) file that I need to read in
Read the file line by line.
Then, on each line, unleash a tokenizer: The boost one[^]comes to mind.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
UNLEASH THE TOKENIZER!!!
Aye, Captain!
Unleashing the tokenizer!
|
|
|
|
|
Mark Salsbery wrote: Aye, Captain!
Unleashing the tokenizer!
Hmm - so my intended joke did not come through.
I always thought "unleash" has a meaning along the lines of "let loose onto", "expose someone to it".
Instead, it seems to be sailor-slag for "untie a rope"
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
No No... the joke DID come through. I actually sprayed coffee on my moniter when I read it haha.
I liked it! I just took it even further.
Mark
|
|
|
|
|
For each line read from the file, you can use AfxExtractSubString() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Is there any way how to close stdout
actualy i can use fclose(stdout) but how to reopen it?
Problem is about:
Program such oggenc.exe are reading data from stdin
i hope i can write them for it into stdout, but how
i will let him know i am done?
thank you
viliam
|
|
|
|
|
why on earth do you want to do such a thing ?
|
|
|
|
|
|
i still don't understand why he would want to close stdandard stream for this...
|
|
|
|
|
you right,
lame and oggenc are during stream encoding using stdin
and i dont know how to let them know that no more data is comming.
viliam
|
|
|
|