|
without the SetLayeredWindowAttributes i dont get the 87 error code form getlast error which is a good news, but the window is not showing and UpdateLayeredWindow is returning 0;
|
|
|
|
|
Lamefif wrote: the window is not showing and UpdateLayeredWindow is returning 0;
If it's returning 0 then it's still failing, right? Or do you mean GetLastError() returns 0?
ACK I just noticed in your code on the other site - you are destroying the memDC. I'm pretty
sure the system is going to need that to draw the window! Try keeping it around for the life of
the window instead.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thanks mark you've been a great help, the window is now showing. it was blend.SourceConstantAlpha = 255; set to 0 i think.
but i still have some problems
im using this image,
http://mathforum.org/library/drmath/gifs/analog_clock.jpg
the white part of the image is showing the blue part is transparent.
and mouse clicks go through the window, regardless where i click on it.
|
|
|
|
|
using LWA_COLORKEY gets around that it seems, but the window comes out pixilated .
now i have to figure out how to use an alpha channel
|
|
|
|
|
Lamefif wrote: the window comes out pixilated
Because you've sized the window bigger than the bitmap??
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
To hide the white you'll need to use
UpdateLayeredWindow(hwnd, NULL, NULL, NULL, dcMem, NULL, RGB(255,255,255), 0, ULW_COLORKEY);
To use alpha blending on the entire bitmap you'd use
UpdateLayeredWindow(hwnd, NULL, NULL, NULL, dcMem, NULL, 0, &blend, LWA_ALPHA);
To use both alpha and color key, you need to use SetLayeredWindowAttributes() instead of
UpdateLayeredWindow()...
SetLayeredWindowAttributes(hwnd, RGB(255,255,255), alphavalue, LWA_COLORKEY | LWA_ALPHA);
Then you'd have to draw the bitmap yourself in response to WM_PAINT.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
im having trouble with the pixilated edge, i tried adding a png file with an alpha cannel as a resource but it came out as row data.. ups.
i want to use perpixilalpha as you can tell, whats the best way to go about this?
thanks again
|
|
|
|
|
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
|
|
|
|
|