| |

VerySource

 Forgot password?
 Register
Search
View: 15|Reply: 4

The problem with SkinMagic skin resurfacing, weird! Let's take a look !!

[Copy link]

1

Threads

3

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

Post time: 2020-2-24 11:00:01
| Show all posts |Read mode
I want to beautify the interface of an MFC program I made, using SkinMagic
First, I created a simple Dialog Test program. Following the instructions in the online article, the skinning was successful.

But when used in my own program, run to InitSkinMagicLib (AfxGetInstanceHandle (), NULL, NULL, NULL) in C *** App :: InitInstance (); in this sentence, that is, when the SkinMagic library is initialized
The program will close incorrectly.
Debugging will appear on the dialog box
Unhandled exception in ***. Exe (SKINMAGICTRIAL.DLL): 0XC000001D: Illegal
Instruction

Ask the master what's going on?
Reply

Use magic Report

0

Threads

4

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

Post time: 2020-5-21 14:15:02
| Show all posts
Post your initinstance code
Reply

Use magic Report

1

Threads

3

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

 Author| Post time: 2020-5-24 09:45:01
| Show all posts
BOOL CAgiLeanChatApp :: InitInstance ()
{
// === load skin ==
HINSTANCE hInstance = AfxGetInstanceHandle ();
VERIFY (1 == InitSkinMagicLib (hInstance, NULL, NULL, NULL));
VERIFY (1 == LoadSkinFile (SOFT_SKIN));
// <==== end ==============================
The
AfxEnableControlContainer ();

// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.

#ifdef _AFXDLL
Enable3dControls (); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic (); // Call this when linking to MFC statically
#endif

// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey (_T ("Local AppWizard-Generated Applications"));

CMainFrame * pFrame = new CMainFrame;
m_pMainWnd = pFrame;

// create and load the frame with its resources

pFrame-> LoadFrame (IDR_MAINFRAME,
WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,
NULL);

// =========== Start skin ======================================= ===
VERIFY (1 == SetWindowSkin (m_pMainWnd-> m_hWnd, "MainFrame"));
VERIFY (1 == SetDialogSkin ("Dialog"));
// <============= end ================================= ========

// Display at the front of the window
SetWindowPos (m_pMainWnd-> m_hWnd, HWND_TOPMOST, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
The
// The one and only window has been initialized, so show and update it.
m_pMainWnd-> ShowWindow (SW_SHOW);
m_pMainWnd-> UpdateWindow ();

return TRUE;
}
Reply

Use magic Report

0

Threads

4

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

Post time: 2020-5-29 09:45:01
| Show all posts
3. Add the following code to the InitInstance () of the App: (note that it should be added after m_pMainWnd is initialized, and it should be added after m_pMainWnd =&dlg;

// =================== Load skin and set skin window ================ * /
VERIFY (1 == InitSkinMagicLib (AfxGetInstanceHandle (), "SDI",
NULL,
NULL));

VERIFY (1 == LoadSkinFromResource (AfxGetInstanceHandle (), "TUSK", "SKINMAGIC"));

VERIFY (1 == SetWindowSkin (m_pMainWnd-> m_hWnd, "MainFrame"));
VERIFY (1 == SetDialogSkin ("Dialog"));
/ * ========================== ENDEND ===================== ========= * /
The above is the instruction of skinmaigc. For your program, you need to put
CMainFrame * pFrame = new CMainFrame;
m_pMainWnd = pFrame
This is placed in VERIFY (1 == InitSkinMagicLib (hInstance, NULL, NULL, NULL));
VERIFY (1 == LoadSkinFile (SOFT_SKIN));
prior to.
Reply

Use magic Report

0

Threads

4

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

Post time: 2020-6-2 21:15:01
| Show all posts
Halo, did not look carefully, your position is correct, you try to put InitSkinMagicLib after m_pMainWnd = pFrame to see it, if not, it is probably the problem of skinmagic. . . . Mine is normal
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list