|
|
Hi all
How i can to get color of pixel on my device context.
I get device context of my dialog box sucessfully and fill necessary rect by black color (COLORREF cr = 0x00000000).I watch so it was succesfully too.But when i get color of pixel from this rect by GetPixel routine it functiont retreive me unexpexcted color (not black)
Why???
Thanks.
|
|
|
|
|
The GetPixel() API expects screen coordinates, not client. You should call ClientToScreen() for your rect before calling GetPixel() .
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
we are developping a screen capture app, but it is too slow.
the steps are:
1. get WindowDC or screen DC
2. create compatible bitmap and DC
3. call BitBlt function to copy image to compatible DC
4. GetDibits of compatible bitmap then save it to a file
the problem is:
step 3 is too slow (over 200 ms), we need to get all info in 30 ms.
we believe that there must be other ideas to do that, because we know many capture apps work very well.
do u have another idea or how to let it work faster ?
thx in advance
includeh10
|
|
|
|
|
This article may or may not be close enough to what you need. It does something entirely different but may trigger some ideas.
http://flounder.com/screencapture.htm
|
|
|
|
|
thx, but it looks the same as above code ...
includeh10
|
|
|
|
|
Just an idea:
Did you try simulating PrintScreen and grabing from ClipBoard (if allowed)?
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Hi!!!
I have a problem reading a checked menu item.I am catching the WM_COMMAND
message and using (LOWORD)wParam checking if the menu item is selected.Can I check if the menu item is checked or not .
Thanx in advance.
|
|
|
|
|
|
Thanx !!!
It worked for me. Are there any articles on Menu Handling apart from MSDN examples.
|
|
|
|
|
|
Problem on porting from VC 6 to VC 7 - context sensitive help [Shift F1 Help] - using Onhelphittest()
OnHelpHitTest() return dialog contol ID to MFC and MFC calls COurWinApp::HtmlHelp()
Which is processed. and appropriate help is displayed. In VC7 MFC isn't calling COurWinApp::HtmlHelp()
HtmlHelp() function is not called instead gives "Failed to launch help" message.
Code Snippet below
------------------------------
To implement Shift F1 help for COurDlgCtrl
#1. we added
LRESULT COurDlgCtrl::OnHelpHitTest(WPARAM wParam, LPARAM lParam)
{
return GetDlgCtrlID(); // Nonzero value
}
#2. Then we added this
void COurWinApp::HtmlHelp(DWORD dwData, UINT nCmd )
{
DWORD HelpID = -1;
WORD wCtrlId = LOWORD (dwData);
WORD DlgCtrlId = HIWORD (dwData);
HANDLE hHtmlHelp;
// Map the Dialog Control IDs to corresponding Help IDs
switch (nCmd)
{
case HELP_CONTEXT:
switch (wCtrlId)
{
case OurDlgCtrlID:
HelpID = IDH_TEMPDLG_DRAG;
break;
default:
HelpID = -1;
}
hHtmlHelp = ::HtmlHelp(NULL,
m_pszHelpFilePath,
HH_HELP_CONTEXT,
HelpID);
}
}
For VC 7 migration
#3. We added EnabeHtmlHelp() in constructor of COurWinApp.
This still doesn't seem to work.
HtmlHelp() function is not called instead get "Failed to launch help" message.
Thanks in advance
Pralhad
|
|
|
|
|
Hi,
I could not execute any MFC files in my system as soon as I execute them , the system comes to a complete halt. A few minutes before I saw this happening to all the executable files in my system...can anyone help me..
Regards
Deepak Samuel
|
|
|
|
|
|
Deepak Samuel wrote:
...execute any MFC files...
Please explain, as MFC files are DLLs, not EXEs. Are you saying that programs built with MFC are causing the system to halt?
|
|
|
|
|
Hello friends,
I have created a folder, which is a shared folder on network.
Now as we know that there are sharing rights like Read, read/write,....etc.
I want to give Read only access to the folder. i hve tried with the ACCESS_READ Flag with the Netshare function but it Fails i mean the folder is still having Read/Write Access !!!!!!!!!!
Can anybody help me out ???????
Thanx
TAKE CARE
|
|
|
|
|
siid wrote:
i hve tried with the ACCESS_READ Flag with the Netshare function but it Fails
Do you mean NetShareSetInfo() ? What is its return value?
|
|
|
|
|
i have done it with NetShareAdd
Thanx
TAKE CARE
|
|
|
|
|
Regardless, what is its return value?
|
|
|
|
|
Hi,
I'm looking for some kind of "VC6 project templates" - i.e. generate the same settings based on an existing .dsp, with a new name etc., but keeping compiler/linker settings, project configurations, etc.
I looked into custom appwizard, but it only generates default configurations.
[edit]I figure a tool where I can pre-configure a search-and-replace, *including* S&R in file names, could dothe job...[/edit]
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
peterchen wrote:
I looked into custom appwizard, but it only generates default configurations.
I never seemed to be able to get it to work when it generates from another project properly either.
Alternatively, create a default project *similar* to what you want (MFC / DLL / Console), then add the source code, you can then use the text from the 'project->settings->link->project options' and 'project->settings->compile->project options' edit boxes to rebuild your compiler options.
I've found that custom appwizards can take quite a while to get exactly right - so if you can use a find and replace for a one off, do that instead.
Some Gotcha's for Custom Appwizards
in 'void CYourProjectAw::InitCustomAppWiz()' make sure that the dictionary sets the correct type of project. For example,
m_Dictionary[_T("PROJTYPE_CON")] = _T("1");
in 'void CYourProjectAw::CustomizeProject(IBuildProject* pProject)' you can set all the compiler options. MSDN / VC6 samples are the best source of info for this. It can be really painful to do this right, because it has to be done for the debug and release builds.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Hi!
I try to wrap a c++ lib behind a COM dll to make it easy to use by VB or c#.
But i have some troubles. Look the demo:
There is two classes in COM DLL, one called Apple and another called Banana.
In Apple i try to hide a struct. It is not on the interface to the client. But the other class in the COM know it is there, and can access it.
struct Image
{
int num;
};
// CApple
class ATL_NO_VTABLE CApple :
public CComObjectRootEx,
public CComCoClass,
public IDispatchImpl
{
public:
Image img;
CApple()
{
}
The class banana has two methods, GetApple create an Apple object and initialize its value, QueryApple try to query the value in the Apple.
interface IBanana : IDispatch{
[id(1), helpstring("GetApple")] HRESULT GetApple([out,retval] IApple** apple);
[id(2), helpstring("QueryApple")] HRESULT QueryApple([in] IApple* apple, [out,retval] int * ret);
};
And in banana.cpp i try
STDMETHODIMP CBanana::GetApple(IApple** apple)
{
CApple* p = new CComObject();
p->img.num = 100;
*apple = p;
return S_OK;
}
STDMETHODIMP CBanana::QueryApple(IApple* apple, int* ret)
{
CApple* p = dynamic_cast(apple);
*ret = p->img.num;
return S_OK;
}
But when i use this dll in c#, it always get a System.ExecutionEngineException.
the script is
FruitLib.Banana banana = new FruitLib.BananaClass();
FruitLib.Apple apple = banana.GetApple();
int n = banana.QueryApple(apple);
What's wrong in my code? Any idea?
Thanks!
|
|
|
|
|
Firstly, when posting code to CodeProject, it's useful to use the <pre> format tag. You should also translate < to < and > to > . Alternatively select the 'Display this message as-is (no HTML) checkbox). Otherwise CP interprets template parameters and system includes as unknown HTML tags and removes them.
Now for the problem:
System.ExecutionEngineException , according to the documentation, is only thrown when an internal problem occurs in the runtime itself.
The problem seems to be occurring when the Interop layer tries to call QueryApple. It never actually gets into the C++ module.
I'll have to confess, I'm not an expert on Interop. I think you need actual support from MS on this one.
|
|
|
|
|
Hi,
is there any way through which i can check into the Access database wheteher the table is created or not?
|
|
|
|
|
you can check the MSysObjects table.
or search for something like:
m_pConnection->OpenSchema((ADOCG::SchemaEnum)eSchema)
it returns a recordset with some infos about the DB
|
|
|
|