|
Have you tried using CImage or the GdiPlus::Bitmap class to load the png?
Then you should be able to use the associated HBITMAP, selected into the dcMem and use
UpdateLayeredWindow() like this:
blend.BlendOp = AC_SRC_OVER;
blend.BlendFlags = 0;
blend.SourceConstantAlpha = 255;
blend.AlphaFormat = AC_SRC_ALPHA;
UpdateLayeredWindow(hwnd, NULL, NULL, NULL, dcMem, NULL, 0, &blend, LWA_ALPHA);
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Also, check success or fail of UpdateLayeredWindow() call BEFORE calling GetLastError() -
in other words, only call GetLastError() if the UpdateLayeredWindow() call fails.
Not all APIs clear the thread's last error when they succeed.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
yes but UpdateLayeredWindow() returns 0 which means is failing.
and the fact that is not doing anything
|
|
|
|
|
Are SIDs for only local machine or are there SIDs related with active directory /domain controller ?
If it is then how can i get SIDs related with active directory /domain controller ?
|
|
|
|
|
Hi,
I had created dll using C# and I had been using that myLib.dll for long time.
But today, I updated myLib.dll and register it again with RegAsm.exe and create the myLib.tlb file as I used to do. However my C++ program couldn't create Instance of dll because "The System cannot findthe file specified." error message today.
What did I do wrong today? It was OK all time. I had updated myDll.dll so many time before and able to called from C++ program using the same function
bool CClientJob::CoInitRoscoeLib(void)
{
m_roscoeLib = NULL;
int retval = 1;
CoInitialize(NULL);
HRESULT hr = CoCreateInstance(CLSID_MyLib,
NULL,
CLSCTX_INPROC_SERVER,
IID_IMyLib,
reinterpret_cast<void**>(&m_myLib));
if (FAILED(hr))
{
CString k;
k.Format(L"Couldn't create the instance!... 0x%x\n", hr);
AfxMessageBox(k);
return false;
}
else
return true;
}
in CClientJob.h i have
#import "C:\Code\2007\03\RoscoeFuns\RoscoeFuns\bin\Debug\myLib_4.tlb" no_namespace named_guids
Why the error message of HRESULT hr is
" 0x80070002 The system cannot find the file specified. "
Please help me out.
Thank you so much.
|
|
|
|
|
clean up your old #import generated files
led mike
|
|
|
|
|
I did removed old dll from the debug and it works for one program but doesnt' work for the other program. Deleting dll from debug doesn't work.. I also tried to regasm /unregister "myLib.dll".
If I go to RegEdit.. I saw lots of classes of myLib.dll repeatly.
Do they suppose to be to appear in HEKY_CKASSES_ROOT, HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CURRENT_CONFIG.
Was it because of memory? How am I going to clean old dll?
Thanks
|
|
|
|
|
pnpfriend wrote: I did removed old dll from the debug
That's not what I said. #import generates header files. If you don't study and understand the technology you use these sorts of problems are inevitable.
led mike
|
|
|
|
|
=( I know.. I tried to learn and I'm still trying to learn.
I have the following line in the header file.
#import "C:\NewLocation\myLib.tlb" no_namespace named_guids
myLib.tlb is the new dll that I created.
It is saved in Newlocation. The file actually exists in NewLocation folder.
Was it that you were talking about? If I'm still wrong and misunderstanding you,
Would you please refer me some links to study more about what I should know.
Thank you Mike.
|
|
|
|
|
pnpfriend wrote: Would you please refer me some links to study more about what I should know.
Here is good one[^]
See the section "Header files created by import"
Hope that helps
led mike
|
|
|
|
|
|
splitterWnd in SDI MFC 1hr 11mins ago
I create a SDI application in MFC wizard with splitter option. I modified OnCreateClient function to create static splitter into two rows and one column, and further split top row to one row and two columns. The code is simple as below:
CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
mainSplitterWnd.CreateStatic(this, 2, 1) ;
//then the childSplitterWnd of the mainSplitterWnd to
CreateStatic(1,2, WS_CHILD | WS_VISIBLE, mainSplitterWnd.IdFromRowCol(0,0));
//then assign both childSplitterWnd to views
childSplitterWnd.CreateView(0,0,RUNTIME_CLASS(CMyChildLeftView),CSize(500,500),pContext);
childSplitterWnd.CreateView(0,1,RUNTIME_CLASS(CMyChildRighView),CSize(100,100),pContext);
//then assign bottom main frame of mainSplitterWnd
mainSplitterWnd.CreateView(1,0,RUNTIME_CLASS(CMyBottomView),CSize(300,300),pContext);
return TRUE;
}
When I execute the code I only see the middle splitter bar display on the very top
of the main frame, then I have do use the mouse to drag splitter bar down. I don't
understand why I have to do that if I create static splitter. Help!!!!
|
|
|
|
|
Which MapMode are you using?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
I use default map mode MM_TEXT. One thing I find out is that if you
// one row and two column then
m_mainSplitterFrame.Createstatic(1,2)
// then further split second column in two row
m_childSplitterFrame.CreateStatic(&m_mainSplitterFrame,1,2,RUNTIME_CLASS(CMyView),CSize(500,500),m_mainSplitterFrame.IDFromColRow(0,1));
This code works as long as you don't split the first pane of the m_mainSplitter.
|
|
|
|
|
gurucplusplus wrote: I don't
understand why I have to do that if I create static splitter.
I dont know either, why CreateStatic or CreateView do not work.
But you can call SetColumnInfo() and SetRowInfo() on the splitters to set the ideal and the minimal size.
RecalcLayout() afterwards.
Failure is not an option - it's built right in.
|
|
|
|
|
Is it true that
m_childSplitterFrame.CreateView(0,0,RUNTIME_CLASS(CMyView),CSize(100,100),pContext)
means create the view with minimum size of CSize()?
|
|
|
|
|
Yes, this is how it is documented.
But for me it somehow does not work.
So I use SetColumnInfo() and SetRowInfo() the first time OnSize() is called.
Failure is not an option - it's built right in.
|
|
|
|
|
I wanted to move some things around, so i moved two functions from my dialog based MFC program (compiler= VC6.0) into a new cpp file called Functions.cpp
I added the functions, and the #include "stdafx.h" to the new cpp file
And added #include "Functions.cpp" into my "stdafx.h" file.
But now when i attemp to compile i get errors like this for both functions:
error C2084: function 'void __cdecl Func1(void)' already has a body
I looked around, tried some ; on the function definitions, tried some #ifdef things but nothing seemed to work...
So what do I do?
thanks a million!
//Johannes
|
|
|
|
|
Johpoke wrote: I added the functions, and the #include "stdafx.h" to the new cpp file
And added #include "Functions.cpp" into my "stdafx.h" file.
You need to create a Function.h file that contains the prototypes for the functions now contained in Functions.cpp and include the .h, not the .cpp, in the stdafx.h file. Add the Functions.cpp file to the project.
You're getting the "function already has body" because stdafx.h contains the contents of Functions.cpp - you told it to include it, so it did - and now you're trying to define the function again in the body of Functions.cpp.
Judy
|
|
|
|
|
Thanks!
Works perfectly now
//Johannes
|
|
|
|
|
Hi,
I have a trouble to create an Avi using DivX compression in VC++. After getting the DIBSECTION information from the 1st DIB bitmap, the AVIStreamSetFormat() generates an AVIERR_BADFORMAT return (for DivX 6.6.1 Codec).
Does anybody know why this happens and how to fix the problem?
Thanks for the help,
Stanley
|
|
|
|
|
Hey guys,
I'm using "ManualMap" (loads a DLL without calling LoadLibrary, does relocating and everything manually) for loading a DLL into a target process, but as soon as the process is running on Vista, it just crashes. I dont know, if its caused by my module itself or the loader (I dont have Vista myself, so I cant test/debug it), but since I read in "Dynamic TEXT Section Image Verification" (http://www.codeproject.com/useritems/VerifyIntegrity.asp), that base relocating is working differently on Vista, this may be the problem. So, could someone explain what is different on Vista? When I have problems implementing it, I'll ask again^^
Xero|Hawk
|
|
|
|
|
Ok... I am working on C++ in highschool, I only just recently learned it, so I am still a beginner. I need some help with something very simple.
I am makeing a program in Visual C++ 6.0, it needs to have a button that says 'Start', and when clicked it changes to 'Stop'. When clicked the first time, a timer starts, and counts until I click the button again to stop it, in wich case the buttons text changes to 'start'.
I have no idea how to change a buttons text mid program. I know how to do timers, those are easy enough, but this button escapes me. Any help you can give would be GREATLY apreaciated.
|
|
|
|
|
Do you need to SetWindowText(); ?
|
|
|
|
|
Hi,
The best way is to create a member for the button using the class wizard.
As far as I remember, In Visual studio 6.0 , you can open the class wizard with ctrl + W.
After creating the member for the button,you can use all its methods using that member.
For example:
Let say that you called your member m_MyButton.
Using that member,you can change It's caption by calling the SetWindowText(i.e m_MyButton.SetWindowText("STOP")).
Eli
|
|
|
|
|