|
|
Which is the opposite of what the OP wanted, yes?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
|
|
I don't think Visual Studio is set up to do this. If you want to use MFC then you should either create an MFC Windows app that contains the dialogs, or an MFC dialog app with tabs or some similar mechanism. If you want to add dialogs to a console app then you will need to do it manually, by adding all the required Win32/MFC framework components.
It's time for a new signature.
|
|
|
|
|
In a console based application, we cant include the dialog which is created by MFC or SDK. If u still need to use the dialog in console application, convert the your console application to win32 application and try to use MFC dialogs.
---Parthi
|
|
|
|
|
Parthiban wrote: In a console based application, we cant include the dialog which is created by MFC or SDK.
Wrong. You could have a console based application support MFC by including the right header files.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Sounds like you didn't create the console application with the MFC app wizard, so the pre-compiled header settings are not set correctly. You also technically need to initialize MFC in main, though this isn't actually required for some parts of MFC (which I used to worry about in the days of very limited memory, but haven't for years.)
|
|
|
|
|
How can i get the column count of list view ......i m doing this in win 32
|
|
|
|
|
It would be a question for the list header :
{
long lCols = 0;
if (hwndList) {
HWND hwndHeader = ListView_GetHeader(hwndList);
if (hwndHeader) {
long lRes = SendMessage(hwndHeader, HDM_GETITEMCOUNT, 0, 0);
if (-1 != lRes) {
lCols = lRes;
}
}
}
}
virtual void BeHappy() = 0;
|
|
|
|
|
thanks Eugen
i m using this macro's
hHeader = ListView_GetHeader(hListview);
g_ncColumns = Header_GetItemCount(hHeader);
|
|
|
|
|
Not quite sure where I should ask this...I mean, this site really needs a Windows programming section, doesn't it?
Anyways, here goes. I have this DLL trying to call mciSendString (command passed as a parameter). The call works fine in an EXE, but it refuses to do anything on a DLL (I'm testing with "set cdaudio door open"). The function gets called but it hangs. Forever.
Stack, if it helps:
ntkrnlpa.exe!ExAllocatePoolWithTag+0x8ab
ntkrnlpa.exe!MmIsDriverVerifying+0xa08
ntkrnlpa.exe!MmIsDriverVerifying+0x12ea
ntkrnlpa.exe!PoShutdownBugCheck+0x32ce
ntkrnlpa.exe!KeSynchronizeExecution+0x10c
ntdll.dll!KiFastSystemCallRet
!WaitForSingleObject+0x12
!waveOutWrite+0x50c
!mci32Message+0x526
!mciSendCommandW+0x10b
!mciSendCommandW+0x48e
!mciSendStringW+0x31
!mciSendStringA+0x87
Thanks!
|
|
|
|
|
It seems to be a "deadlock"...
(for example, a recursion on the code block,
what is protected by a critical section...
...like: mciSendCommand(..)->mciSendString(..)->mciSendCommand(..))
virtual void BeHappy() = 0;
|
|
|
|
|
So why does it work from an EXE but not a DLL?
And what should I do to fix it?
|
|
|
|
|
May be the analyzing of the stack
before the call will help...
virtual void BeHappy() = 0;
|
|
|
|
|
hello sir
This is my program
char block[3];
block[0] = 'a';block[1] = 'a';block[2] = 'a';
cout << block;
out of this program
aaa╠╠╠╠╠╕ ↕
why this kind unknown character is printing ...
Failure is Success If we learn from it!!
|
|
|
|
|
char block[4];
block[3] = '\0';
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hey everyone! I am wondering why this code keeps throwing me exceptions and how I can fix this problem.
#include <boost/filesystem.hpp>
namespace bf = boost::filesystem;
#include <string>
#include <iostream>
using namespace std;
string e_string = "Error";
int main()
{
string fileName = "C:\\Downloads\\Hits from the Bow\\01 This Time You're Gonna Get it Dir.mp3";
string destination = "c:\\downloads\\test" ;
bf::path fileCopied(fileName);
bf::path fileCopiedDestination (destination);
if (!bf::exists(fileCopied) )
{
cerr << e_string;
}
if (!bf::exists(fileCopiedDestination))
{
cerr << e_string;
}
try
{
bf::copy_file(fileCopied,fileCopiedDestination);
}
catch(std::exception e)
{
cout << e.what();
}
}
Thanks for your time
|
|
|
|
|
Okay So I found out away for the copy_file() function to work
#include <boost/filesystem.hpp>
namespace bf = boost::filesystem;
#include <string>
#include <iostream>
using namespace std;
string e_string = "Error";
int main()
{
string fileName = "C:/Downloads/Hits from the Bow/01 This Time You're Gonna Get it Dir.mp3";
string destination = "c:/downloads/test/this is why it wouldnt work.mp3" ;
bf::path fileCopied(fileName);
bf::path fileCopiedDestination (destination);
if (!bf::exists(fileCopied) )
{
cerr << e_string;
}
if (!bf::exists(fileCopiedDestination))
{
cerr << e_string;
}
try
{
bf::copy_file(fileName,destination);
}
catch(std::exception e)
{
cout << e.what();
}
}
I did not specify the file name. But I do not think this actually solves the full problem because An exception is still being thrown, any ideas at all?
|
|
|
|
|
sorry for the spam.. I think i figured it out. The destination file also dosnt exists in the first place. Thanks anyways.. If any one has any comments i would be happy to hear them!
|
|
|
|
|
Suggestion: Your original question states that you get an exception, but you did not post the message raised by the exception. People reading your question cannot guess what that exception might be.
It's time for a new signature.
|
|
|
|
|
Hi everyone, I am working on a project that requires me to write a program which given a single word will search a database of thousands of songs and will return the artist, title, and the context in which the word appears in the song. Each song has a SongId and other meta data details and the whole database is in the form of one huge text file with a single space between two songs. I have attached an example.
I am attaching the header and cpp file containing my code to sift through the database.I have come up with a design that uses patricia trie containing all the words and array/linked list which contains all the song ids with each word in the tree referring to the SongId(s) in linked list/array that contains that word. I was also contemplating using a hash table as the song database is static. For the patricia trie I have two more linked lists containing maps of the nodes of the trees with the information regarding if the given node is a leaf or not and if it is an internal node how many eliminated nodes (as it is a patricia trie) does it store. I then intent to do a binary search on this structure to make the search even faster. I am attaching the code to my patricia tree too.
I think I know how my code is going to work but am having trouble implementing it beyond a point. I am in a roadblock and am not able to bring everything together. Hence I would truly appreciate if someone can help me with this.
Let me know if there's any other info that you want. Alternative ideas of the algorithm are welcome, though I am heavily constrained by time.
DatabaseAPICode http://www.dreamincode.net/forums/index.php?app=core&module=attach§ion=attach&attach_id=18078[^]
Patricia Tree Code http://www.dreamincode.net/forums/index.php?app=core&module=attach§ion=attach&attach_id=18079[^]
|
|
|
|
|
Good afternoon!
Taking the following into account:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[]){
int pid;
int p[2];
int q[2];
int a;
int b;
a = pipe(p);
if(a == -1)
{
fprintf(stderr, "Pipe Failed.\n");
return EXIT_FAILURE;
}
b = pipe(q);
if(b == -1)
{
fprintf(stderr, "Pipe Failed.\n");
return EXIT_FAILURE;
}
pid = fork();
switch(pid){
case -1:
perror("main: fork");
exit(1);
case 0:
printf("Child process ID: %d\n", pid);
break;
default:
printf("Parent process ID: %d\n", pid);
break;
}
getchar();
return 0;
}
The child program will execute a list of commands that it receives from the parent (via pipe p). I have a menu of commands that will run in the parent process and send the user's choice to the child for execution. The child will send the results back to the parent when done (through pipe q), so the parent process may display the results.
In the code sample I submitted, I've created both pipes, p and q. Then, I forked the child process. My question is how will the child know to recieve it's commnads through pipe p and how will the parent know to receive the results through pipe q? Should the creation of the second pipe occur later in the code than where it is located?
As always, I greatly appreciate the guidence that I have recieved while visiting forums such as this one. Any and all suggestions are welcome!
|
|
|
|
|
As it is in the code, the return address of fork is checked to determine if the control is in the child or parent process.
So if the return value is 0, it means it is the child process and so code for the child is written in case 0: and code for the parent is written in default:
Also, why do you need to create two pipes.
The pipe call returns a double ended pipe which can be used for 2 way communication.
|
|
|
|
|
Thank you very much for the reply. I know that I can use a single pipe, but my assignment is to use two different pipes, p and q.
|
|
|
|