|
hi!
i'm creating a media playing.. using MCI .... the app dosen't play files from multiple directories... though they are added to the listbox.. they are not played .
The problem is that i want to load files from multiple directories and it plays files only from one directory... i.e the one from which the files were last loaded from. the files that were loaded from other directories do not play - V.G
|
|
|
|
|
What do you mean by "do not play?" Do you receive some sort of error message? Since paths are involved, are you confusing absolute with relative paths?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
#include <iostream.h>
class B {
public :
int datab;
virtual void AccessB() { };
protected :
int datac;
};
class D :virtual public B {
public :
void AccessB()
{
datab=1;
cout<<"Data is"<<datab<<endl;
datab="10;
" cout<<"data="" is="" "<<datab<<endl;
="" datac="1;
" }
};
class="" a="" :="" virtual="" public="" b="" {
="" :
="" void="" accessb()
="" cout<<endl<<"="" i="" am="" "<<endl;
="" }
};
class="" e="" d="" ,=""
{
public="" :
=""
="" accessd()
="" }
};
void="" main()
{
="" bobj;
="" *bptr="" ;="" dobj;
="" bptr="&dobj;
" bptr-="">AccessB();
}
This doesnt compile as AccessB is unresolved in E . I dont want an implementation of AccessB in E , What needs to be changed ?
|
|
|
|
|
|
Hi,
I'm having a problem passing command line arguments in VS 2003 without opening a command prompt. The link below shows a picture of my debugging properties dialog box. My command arguments are set as shown in the picture. When I run the program in debug mode from the IDE, argc is always equal to 1, regardless of the content of the command arguments edit box. I don't have this problem when I do the same procedure from the command prompt.
What am I missing?
http://groups.msn.com/_Secure/0TQAAAPAYi*BNCm8Mz8eUuz9tIVTfLstvPYH5Adg69*I2R2hO*fV9qTZlCyf!0iXvfbGRM2ifmlrvxywZWPQSzq7KKzeWUNC3hqCjMo01zvIlivF!okCEdw/problem.jpg
Cheers, blackmesa.
|
|
|
|
|
Hi guys,
I'm writing a program that should monitor the "active" application's copying and pasting.I decided on using use a system-wide WH_CBTPROC hook and a thread-specific WH_CALLWNDPROC hook to capture the WM_PASTE and WM_COPY messages.
The hooking works OK, the problem is that the WH_CALLWNDPROC causes the menus in "Microsoft Word" not to display. Am i using the hook wrong? (Maybe not passing the messages along). And it makes the programs realllllyy slowww. I'm running a Duron 800mhz, should it have such a big influence on performance?
Any Ideas? Thanks
The base code looks like this.
<br />
HINSTANCE hins;<br />
HHOOK hmsg = NULL;<br />
HHOOK hcbt = NULL;<br />
<br />
BOOL APIENTRY DllMain( HANDLE hModule, <br />
DWORD ul_reason_for_call, <br />
LPVOID lpReserved<br />
)<br />
{ <br />
hins=(HINSTANCE)hModule;<br />
<br />
switch (ul_reason_for_call)<br />
{<br />
case DLL_PROCESS_ATTACH:<br />
case DLL_THREAD_ATTACH:<br />
case DLL_THREAD_DETACH:<br />
case DLL_PROCESS_DETACH:<br />
break;<br />
}<br />
return TRUE;<br />
}<br />
LRESULT CALLBACK MsgProc(int nCode, WPARAM wParam, LPARAM lParam)<br />
{<br />
char *file = new char[100];<br />
file = "c:\\test.txt";<br />
fstream out(file,ios::out | ios::app);<br />
<br />
<br />
if (nCode < 0)<br />
{<br />
LRESULT RetVal = CallNextHookEx( hmsg, nCode, wParam, lParam ); <br />
return RetVal;<br />
}<br />
<br />
<br />
if (HC_ACTION==nCode) <br />
{<br />
CWPSTRUCT *msgInfo = (CWPSTRUCT*)lParam;<br />
switch (msgInfo->message)<br />
{<br />
case WM_COPY: <br />
out << "COPY" << endl;<br />
break;<br />
<br />
case WM_PASTE:<br />
out << "PASTE" << endl;<br />
break;<br />
}<br />
}<br />
<br />
LRESULT RetVal = CallNextHookEx( hmsg, nCode, wParam, lParam ); <br />
return RetVal;<br />
}<br />
LRESULT CALLBACK CBTProc(int nCode, WPARAM wParam, LPARAM lParam)<br />
{<br />
char *file = new char[100];<br />
file = "c:\\test.txt";<br />
fstream out(file,ios::out | ios::app);<br />
<br />
<br />
DWORD ProcessId;<br />
char szModName[MAX_PATH];<br />
HWND current_window;<br />
<br />
HANDLE hProcess;<br />
SYSTEMTIME SystemTime;<br />
<br />
if (nCode == HCBT_ACTIVATE)<br />
{ <br />
<br />
current_window = (HWND)wParam;<br />
<br />
GetWindowThreadProcessId( current_window,&ProcessId);<br />
<br />
hProcess = OpenProcess( PROCESS_QUERY_INFORMATION |<br />
PROCESS_VM_READ,<br />
FALSE, ProcessId );<br />
<br />
int length = GetModuleFileNameEx( hProcess, NULL, szModName,sizeof(szModName));<br />
<br />
out << szModName << endl;<br />
<br />
if (hmsg == NULL)<br />
{<br />
hmsg = SetWindowsHookEx(WH_CALLWNDPROC,(HOOKPROC)MsgProc,hins,GetWindowThreadProcessId(current_window,0));<br />
}<br />
<br />
}<br />
<br />
<br />
return CallNextHookEx( hcbt, nCode, wParam, lParam ); <br />
}<br />
KEYHOOK_API BOOL installhook()<br />
{<br />
hcbt = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTProc,hins,0);<br />
return TRUE;<br />
}<br />
|
|
|
|
|
1. You are 'new' the data each time the function is called? Where do you ever delete your character buffers?
2. Each time HCBT_ACTIVATE is activated you set a windows hook, where do you release the window hook?
3. You write to the same file from each handler. Are you ensured that none of these will be called from multiple threads at the same time?
4. What CloseHandle? "When you are finished with the handle, be sure to close it using the CloseHandle function."
5. I would probably only set hIns on the DLL_PROCESS_ATTACH call, and not on the others.
|
|
|
|
|
The constant calls to 'new' the character buffers (which you don't delete) and opening files are going to have a big performance hit. Doing that each time it will be very slow.
Mike
|
|
|
|
|
Thanks for the excellent suggestions.
Works great now
|
|
|
|
|
Hi
Can some one show me how to write an Enter character (chr 13) to a file?
HANDLE hAppend;
DWORD dwBytesRead, dwBytesWritten;
char buff[1];
TCHAR* filnavnhtml;
hAppend = CreateFile (filnavnhtml, // Open .txt.
GENERIC_WRITE, // Open for writing
0, // Do not share
NULL, // No security
CREATE_ALWAYS, // Open or create
FILE_ATTRIBUTE_NORMAL, // Normal file
NULL); // No template file
// write an enter character to the file
WriteFile (hAppend, buff, dwBytesRead,
&dwBytesWritten, NULL);
|
|
|
|
|
After calling CreateFile() , you'll need to call SetFilePointer(..., FILE_END) to position the file pointer to the end of the file. After that, the call to WriteFile() will look something like:
BYTE b = 13;
WriteFile(..., &b, 1, ...);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi gunnar66,
Here you go...
// Write a carriage return to the file
DWORD dwBytesWritten = 0;
BYTE obByte = 0x0d;
WriteFile(m_hLogFile, obByte, 1, &dwBytesWritten, NULL))
regards,
Dark Angel
|
|
|
|
|
I'm putting this here because I've posted it in the managed C++ forum a couple of times, and I haven't gotten an answer yet.
I have a very good book (except for this one thing) by Tom Archer,"Extending MFC Applications with the .Net framework" and "Visual C++.Net Bible" by the same author, and also "Visual C++ .Net - Step by Step" by Microsoft.
Is there a way to build a mixed (native + managed) that starts off with a CFormView, and then call a windows form that I've created? There's examples for using a windows form if it's the startup form, but not if it's a second form called from an mfc class. Does ANYBODY know how to do this?
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
BlackDice wrote:
I'm putting this here because I've posted it in the managed C++ forum a couple of times, and I haven't gotten an answer yet.
Probably you won't get it here, too.
Yes, even I am blogging now!
|
|
|
|
|
I have a SDI Visual C++ program. It has 1 child window with the title bar... containing the minimize, maximize, and X for closing the Window. I DO NOT want this title bar to be loaded as part of the window when the program starts up. How can someone tell me how to do this?
Thanks.
Jerry
|
|
|
|
|
modify the createstruct parameter in the CMainFrame class's OnCreate() member function. I don't know the exact styles off the top of my head, but you'll want to change the styles with the 'window styles' constants. (the ones that begin with WS_), like WS_THICKFRAME,WS_MINIMIZE, etc.
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
use following
cs.style &= ~WS_MAXIMIZEBOX;
|
|
|
|
|
I have a need to put together a simple installation that will run from the users CD ROM drive. I have 2 Visual C++ applications that would be installed on a users machine...a few dlls and I need to register an Active X control also at install time. Can someone help me with this? It does not need to be anything fancy. Just a simple installation program that works.
Thanks.
Jerry
|
|
|
|
|
I use Inno Setup freeware, very easy to use and I think it will install an active x control for you, check the features page.
"An expert is a person who has made all the mistakes that can be made in a very narrow field." - Neils Bohr
|
|
|
|
|
|
Hi everyone,
my app should update a listcontrol inside a while statement, but the data are shown only at the end of the whole function, when the app gets the idle state. Furthermore, all the buttons can't be pressed until the end of the function. Can somenone explain me the way to work with it?
Thanks
Vilmer
|
|
|
|
|
try putting a call to Sleep() for a few milliseconds in your while loop, or make the function static and use AfxBeginThread() to call the function.
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
It sounds like you would benefit from a separate thread that updates the list control. This would allow the GUI to remain responsive to button clicks and repainting.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Yeah, you hit the problem.
But the items of the listcontrol are related to some data which change in the while loop. If I use threads, the data taken from any thread won't be correct, because the while statement continue its run, not taking care of the threads execution.
My question is: is there any way to create a (or more) thread which can use dynamic data which depend on something outside the thread? I know that threads can refer to a pointer to parent, and they can use its member variables, but there's no way for me to make that data useful, because they change always.
|
|
|
|
|
I was thinking more of having the whole function with the while loop in it be executed through a thread. Then there's 3 choices I can think of:
1. send a pointer to your parent class's instance, and access its variables through this pointer.
2. send a pointer to your parent class's instance, then make the variables/values that will be changing static members of the parent class
3. make the variables/values global
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|