Click here to Skip to main content
15,905,232 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionanti-debug product for MFC? Pin
darbien siamak13-Jul-06 16:16
darbien siamak13-Jul-06 16:16 
AnswerRe: anti-debug product for MFC? Pin
Phil.Benson13-Jul-06 21:28
professionalPhil.Benson13-Jul-06 21:28 
QuestionFilling a square? Pin
Lord Kixdemp13-Jul-06 12:49
Lord Kixdemp13-Jul-06 12:49 
AnswerRe: Filling a square? Pin
earl13-Jul-06 13:22
earl13-Jul-06 13:22 
GeneralRe: Filling a square? Pin
Lord Kixdemp13-Jul-06 16:10
Lord Kixdemp13-Jul-06 16:10 
GeneralRe: Filling a square? Pin
Rilhas17-Jul-06 12:47
Rilhas17-Jul-06 12:47 
GeneralRe: Filling a square? Pin
Lord Kixdemp18-Jul-06 12:33
Lord Kixdemp18-Jul-06 12:33 
QuestionSubclass main Winamp window from plugin Pin
u0m313-Jul-06 12:13
u0m313-Jul-06 12:13 
Hy. I'm trying to subclass the main winamp window in order to be able to get winamp internal information without using a timer(ie: current song artist, album, title, lenght, ..., volume, etc). I'm currently having trouble sbuclassing the winamp window (don't actualy know how to do it)

If some one could tell me what I did wrong, or what could be done better, I wold be realy grateful.
Here's the code:
========================================================================================
// gen_mymsc.cpp : Defines the initialization routines for the DLL.
//

#include "stdafx.h"
#include "gen_mymsc.h"
#include "gen.h"
#include "confDiag.h"
#include "wa_ipc.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

//
//TODO: If this DLL is dynamically linked against the MFC DLLs,
// any functions exported from this DLL which call into
// MFC must have the AFX_MANAGE_STATE macro added at the
// very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//


// Cgen_mymscApp

BEGIN_MESSAGE_MAP(Cgen_mymscApp, CWinApp)
END_MESSAGE_MAP()


// Cgen_mymscApp construction

Cgen_mymscApp::Cgen_mymscApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}

int Cgen_mymscApp::winampInit()
{
AfxMessageBox(_T("Winamp has initiated the plugin."), MB_ICONASTERISK, 0);
return 0;
}

void Cgen_mymscApp::winampConfig()
{
CconfDiag *confDiag = new CconfDiag();
//INT_PTR
confDiag->DoModal();
}

void Cgen_mymscApp::winampQuit()
{
AfxMessageBox(_T("Winamp has destroyed the plugin!!! Cry | :(( "), MB_ICONASTERISK, 0);
}

int Cgen_mymscApp::winampSongChanged()
{
return 0;
}

// The one and only Cgen_mymscApp object

Cgen_mymscApp theApp;


// Cgen_mymscApp initialization

BOOL Cgen_mymscApp::InitInstance()
{
CWinApp::InitInstance();
hwndWinamp = FindWindowW(_T("Winamp 1.x"), NULL);
return TRUE;
}



/*********************************
* Winamp main functions *
*********************************/
WNDPROC lpWndProcOld = NULL;
LONG winampLong;
bool smth = false;
HWND winampHWND;

int init(){
AFX_MANAGE_STATE(AfxGetStaticModuleState());
winampHWND = FindWindow(L"Winamp v1.x", NULL);
winampLong = GetWindowLong(winampHWND, 0);
lpWndProcOld = (WNDPROC)SetWindowLong(winampHWND, GWL_WNDPROC, winampLong);
return theApp.winampInit();
}

void config(){
AFX_MANAGE_STATE(AfxGetStaticModuleState());
theApp.winampConfig();
}

void quit(){
AFX_MANAGE_STATE(AfxGetStaticModuleState());
theApp.winampQuit();
}

LRESULT CALLBACK MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
AfxMessageBox(L"We has entered the the callback procedure");
if(message==WM_WA_IPC && lParam==IPC_ISPLAYING && smth==false)
{
AfxMessageBox(L"Winamp is playing");
smth = true;
return 0;
}
return CallWindowProc(lpWndProcOld,hwnd,message,wParam,lParam);
}

winampGeneralPurposePlugin plugin =
{
GPPHDR_VER,
"Multi - Yahoo! Messenger Status Changer (gen_mymsc.dll)",
init,
config,
quit,
};

extern "C" {
__declspec(dllexport) winampGeneralPurposePlugin *winampGetGeneralPurposePlugin(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return &plugin;
}
}
===============================================================================================
http://rafb.net/paste/results/6vBdVY85.nln.html <-the same code with sintaxHighlight
AnswerRe: Subclass main Winamp window from plugin Pin
Justin Tay13-Jul-06 17:47
Justin Tay13-Jul-06 17:47 
GeneralRe: Subclass main Winamp window from plugin Pin
u0m315-Jul-06 5:25
u0m315-Jul-06 5:25 
GeneralRe: Subclass main Winamp window from plugin Pin
u0m318-Jul-06 2:15
u0m318-Jul-06 2:15 
GeneralRe: Subclass main Winamp window from plugin Pin
Justin Tay18-Jul-06 3:48
Justin Tay18-Jul-06 3:48 
QuestionCan I still use DLLs ? Pin
vcpp_cgr13-Jul-06 11:49
vcpp_cgr13-Jul-06 11:49 
AnswerRe: Can I still use DLLs ? Pin
Jun Du13-Jul-06 13:34
Jun Du13-Jul-06 13:34 
QuestionHBITMAP from clipboard Pin
Luksky13-Jul-06 11:43
Luksky13-Jul-06 11:43 
AnswerRe: HBITMAP from clipboard Pin
Chris Losinger13-Jul-06 11:52
professionalChris Losinger13-Jul-06 11:52 
GeneralRe: HBITMAP from clipboard Pin
Luksky14-Jul-06 0:18
Luksky14-Jul-06 0:18 
GeneralRe: HBITMAP from clipboard Pin
Luksky15-Jul-06 5:21
Luksky15-Jul-06 5:21 
QuestionError: LNK2019: Unresolved external symbol... Pin
jon-8013-Jul-06 10:42
professionaljon-8013-Jul-06 10:42 
AnswerRe: Error: LNK2019: Unresolved external symbol... Pin
Chris Losinger13-Jul-06 11:52
professionalChris Losinger13-Jul-06 11:52 
GeneralRe: Error: LNK2019: Unresolved external symbol... Pin
jon-8014-Jul-06 6:15
professionaljon-8014-Jul-06 6:15 
GeneralRe: Error: LNK2019: Unresolved external symbol... Pin
Rilhas17-Jul-06 12:54
Rilhas17-Jul-06 12:54 
QuestionC++ Exception Programming Pin
pgav13-Jul-06 9:50
pgav13-Jul-06 9:50 
AnswerRe: C++ Exception Programming Pin
led mike13-Jul-06 9:55
led mike13-Jul-06 9:55 
QuestionRe: C++ Exception Programming [modified] Pin
pgav13-Jul-06 10:41
pgav13-Jul-06 10:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.