|
I made a test. Both version 1 and version 2 work fine on my system.
Of course I had to provide a value for the file std::str variable (and I used different path and executable).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
God, how I hate programming
Thanks again ...
|
|
|
|
|
I found it. What a bugger.
I got my file name from an absolute path like this
string path = wdPath.substr( 0, index+1 );
string file = wdPath.substr( index+1 );
And though 'file' was displayed correctly in the watch, it seems to have contained some invalid sign. Cause like this ...
string path = wdPath.substr( 0, index+1 );
string file = wdPath.substr( index+1, wdPath.size()-index-2 );
... it works.
Cheers
Souldrift
|
|
|
|
|
Hi all,
in SHBrowseForFolder Function when window open its title is "Browse for folder".
please tell me can i change it.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
The SHBrowseForFolder [^] takes in a pointer to a BROWSERINFO[^] structure.
You can assign the lpszTitle of BROWSERINFO and pass the BROWSERINFO to SHBrowseForFolder .
|
|
|
|
|
In BROWSERINFO structur the parameter discription like this
"lpszTitle
Pointer to a null-terminated string that is displayed above the tree view control in the dialog box. This string can be used to specify instructions to the user.
"
this parameter not change the main window title.
please help me.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
LPMALLOC pMalloc;
LPITEMIDLIST pidl;
TCHAR szPath [MAX_PATH];
BROWSEINFO bi = { GetSafeHwnd(), NULL, szPath,
_T("Test title for browse dialog"),
BIF_VALIDATE|BIF_UAHINT|BIF_NEWDIALOGSTYLE|BIF_NONEWFOLDERBUTTON|BIF_RETURNONLYFSDIRS, NULL, NULL };
pidl = SHBrowseForFolder ( &bi );
if ( NULL != pidl )
{
SHGetMalloc ( &pMalloc );
pMalloc->Free(pidl);
pMalloc->Release();
}
here the window title is remain same "Browse for folder",and "Test title for browse dialog" comes above on dir tree.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
You may use the lpfn member of the struct, for instance
int CALLBACK MyCallback(
HWND hwnd,
UINT uMsg,
LPARAM lParam,
LPARAM lpData
)
{
if (uMsg == BFFM_INITIALIZED)
SetWindowText(hwnd, _T("Hi folks"));
return 0;
}
and then
BROWSEINFO bi = {
GetSafeHwnd(),
NULL,
szPath,
_T("Test title for browse dialog"),
BIF_VALIDATE|BIF_UAHINT|BIF_NEWDIALOGSTYLE|BIF_NONEWFOLDERBUTTON|BIF_RETURNONLYFSDIRS,
MyCallback,
NULL
};
pidl = SHBrowseForFolder ( &bi );
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
As you've found out, the lpszTitle member of the BROWSEINFO structure does what it says - changes the text above the tree control, rather than the title.
I'd agree that the variabke name is a bit misleading, but the help text tells the truth.
Maybe make a browsecallbackproc?
The docs say that the first parameter of this callback function is the window of the browese dialog. Could yopu call SetWindowText from there? It passes a BFFM_INITIALIZED message to the proc, so you could change the text very soon.
Good luck,
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Thank u very much its really helps me.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
one more question for browse for folder the ok button enable on my computer type location i want this type of location the ok button should be disable.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
1) You can set the ulFlags member of the BROWSEINFO structure you pass to SHBrowseForFolder to specify that (for example) you only want file-system directories.
2) You can implement functionality in the BrowseCallbackProc[^] to enable/disable the OK button.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi I made the following program for depth first search but I am having wrong path. Can anyone catch or tell me what I am doing wrong here. I dont know much how to use the debugger in turbo c professional.
Thanks and regards, Mike.
#include <stdio.h>
#include <conio.h>
#define MAX 6 // Node/Vertex count
int adj[MAX][MAX]={ // Adjacency Matrix 2x2
{0,1,1,1,0,0},
{1,0,0,0,1,1},
{1,0,0,0,0,0},
{1,0,0,0,0,0},
{0,1,0,0,0,0},
{0,1,1,0,0,0}
};
int visited[MAX]; // Visited array
void bfs(int goal); // bfs function
int main ()
{
int g=5; //set Goal node
clrscr();
printf("The nodes order is ");
bfs(g);
return 0;
}
void bfs(int goal)
{
int queue[MAX];
int i,front,rear,root;
front=rear=0;
for (i=1;i<=MAX;i++)
visited[i]=0;
visited[goal]=1;
queue[rear++]=goal;
while(front!=rear)
{
root=queue[front];
for(i=1;i<=MAX;i++)
{
if (adj[root][i] && !visited[i])
{
visited[i]=1;
queue[rear++]=i;
printf("%d",i);
}
front++;
}
}
}
|
|
|
|
|
Is the queue circular , if so you need to check for ends and rotate the queue's front/rear back to 0.
Refer here Circular Queue[^]
|
|
|
|
|
No, it is not circular. It is just a FIFO queue.
|
|
|
|
|
For loops be for(i=0 ; i<MAX ; ++i)
front++; should be outside the for loop.
-Saurabh
|
|
|
|
|
Output is wrong if I take it out of the for loop 
|
|
|
|
|
Sry im not good at algorithms, when i ran your code in vs there was an error in
the 3rd line of the code below
root=queue[front];
for(i=1;i<=MAX;i++)
{
if (adj[root][i] && !visited[i])
ie : adj[root][i] , the root value was garbage,
and root=queue[front]; here front was 6 and queue[6] was uninitialized
|
|
|
|
|
thanks for the reply. I am using the turbo c 3.0 IDE, I never knew it could run in visual studio.
I had a hard time debugging this inside the turbo c ide so I posted it here.
Mike.
|
|
|
|
|
Cant get it to work. The output is a blank screen
#include <stdio.h>
#include <conio.h>
#define MAX 6 // Node/Vertex count
int adj[MAX][MAX]={
{0,1,1,1,0,0},
{1,0,0,0,1,1},
{1,0,0,0,0,0},
{1,0,0,0,0,0},
{0,1,0,0,0,0},
{0,1,1,0,0,0}
};
int visited[MAX];
void bfs(int goal);
int main ()
{
int s=3;
clrscr();
printf("The nodes order is ");
bfs(s);
return 0;
}
void bfs(int source)
{
int queue[MAX];
int i,front,rear,root;
front=rear=0;
for (i=1;i<MAX;i++)
{
visited[i]=0;
}
queue[++rear]=source;
visited[source]=1;
printf("%d :",source);
while(rear!=front)
{
root=queue[++front];
for(i=0;i<MAX;i++)
if (adj[root][i] && !visited[i])
{
queue[rear++]=i;
visited[i]=1;
printf("%d",i);
}
front++;
}
}
|
|
|
|
|
What is your required output.
Please specify the output needed for the above program inputs.
|
|
|
|
|
Hello mate, thanks for the reply. I need breadth first traversal on a graph, but its not working properly.
The program hangs inside my turbo c ide and I have to use 'break' to get out of the infinite loop. Also I dont know how to debug inside turbo c 3 IDE so having a hard time debugging the problem in my code.Please help me.
Thanks and best regards, Mike.
|
|
|
|
|
Changes made :
for (i=0;i<MAX;i++)
{
visited[i]=0;
}
queue[rear++]=source; // its not ++rear as it becomes queue[1] instead of queue[0]
.....
.....
while(rear!=front)
{
root=queue[front]; //no need to increment front here
This is the output i got
The nodes order is 3 :01245
|
|
|
|
|
The program is for breadth first traversal of a graph. The output is there but program is crashing. I have to use break to stop from infinite looping.
|
|
|
|
|
rear=0;
1) queue[rear++]=source; // is same as queue[0]=source; and rear increments after assignment;
2) queue[++rear]=source; // is same as queue[1]=source; here rear increments before assignment;
Its from the precedence of operators in c, check operator precedence table[^]
The below program with minor changes as specified above runs fine in my turbo c , just add a getch() in main
#include <stdio.h>
#include <conio.h>
#define MAX 6 // Node/Vertex count
int adj[MAX][MAX]={
{0,1,1,1,0,0},
{1,0,0,0,1,1},
{1,0,0,0,0,0},
{1,0,0,0,0,0},
{0,1,0,0,0,0},
{0,1,1,0,0,0}
};
int visited[MAX];
void bfs(int goal);
int main ()
{
int s=3;
clrscr();
printf("The nodes order is ");
bfs(s);
getch();
return 0;
}
void bfs(int source)
{
int queue[MAX];
int i,front,rear,root;
front=rear=0;
for (i=0;i<MAX;i++)
{
visited[i]=0;
}
queue[rear++]=source;
visited[source]=1;
printf("%d :",source);
while(rear!=front)
{
root=queue[front];
for(i=0;i<MAX;i++)
if (adj[root][i] && !visited[i])
{
queue[rear++]=i;
visited[i]=1;
printf("%d",i);
}
front++;
}
}
|
|
|
|
|