|
Create an MFC DLL project.
Create a dialog template as a resource in the DLL.
Add the web browser control in the dialog.
Create and export a function in the DLL that will show the dialog and call member functions of the browser control like Navigate2 to execute the PHP script.
Now you can load the DLL from an application and call the exported function to display the dialog or customized web browser as you call it.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
hi all,
i am sorry i dont know weather i could ask this question ornot coz, these r the
thinks always run in my mind.
since we call sizeof as operator but y does we use it as sizeof(type) as a function...
plese if any buddy finds it silly forgive me i even tried with google i didnt find it out..
|
|
|
|
|
well ... technically speaking ... every operator IS a function.
So what's the difference ?
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
emilio_grv wrote: well ... technically speaking ... every operator IS a function
In a language like Haskell, yes. In C or C++, not so much - for example, can you show me how to get the address of +, so I can use it as a functor in an STL algorithm?
To elaborate on the Haskell reference - any operator can be used where a function could be used by surrounding it in parentheses. Similarly, any function can be used as an operator by enclosing it in backticks.
For example:
-- Define an addition function
add x y = x + y
-- Define two functions that add integer lists. The first uses the + operator
-- as a function, the second uses add. They are equivalent.
addLists1 :: [Int] -> [Int] -> [Int]
addLists1 l1 l2 = zipWith (+) l1 l2
addLists2 :: [Int] -> [Int] -> [Int]
addLists2 l1 l2 = zipWith add l1 l2
-- The 4 lines of main are equivalent - they all add 3 and 4 with
-- different combination of operator/function and operator/function syntax.
main = do
print (add 3 4)
print ((+) 3 4)
print (3 `add` 4)
print (3 + 4)
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote: can you show me how to get the address of +, so I can use it as a functor in an STL algorithm?
Good point! And that's probably the difference that makes the standard deployers to use different therms.
In theory it shold be &operator+ , but that's ambiguous because of its overloading ...
Thanks for pointing this out.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
Mmm - thinking about it, you *can* use something like that for class/struct types:
struct XX
{
};
XX operator+( XX const&, XX const& ) {}
struct YY
{
};
YY operator+( YY const&, YY const& ) {}
int main()
{
&static_cast<XX( & )( XX const&,XX const& )>(operator+);
&static_cast<YY( & )( YY const&,YY const& )>(operator+);
}
The static_cast effectively specifies which operator+ you want.
But you can't use that for built-in types.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
hawk23reddy wrote: y does we use it as sizeof(type) as a function...
Because that's what the C and C++ Standard's define. To quote the C++ Standard:
The sizeof operator yields the number of bytes in the object representation of its operand. The operand is either an expression, which is not evaluated, or a parenthesized typeid.
And you're better off using parentheses with expressions, as sizeof has higher precedence than most arithmetic operators. Consider this code:
#include <stdio.h>
int main(int argc, char** argv)
{
printf("%d\n", (int)(sizeof 3+4));
printf("%d\n", (int)(sizeof (3+4)));
}
Because sizeof has higher precedence than +, sizeof 3+4 == (sizeof 3) + 4.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
The parenthesis are required if you are requesting the size of a type (e.g., int ). Otherwise, the parenthesis are optional.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
hi thankx for answer
but y for int (or types) the parenthesis is required is there
any conceret reason
|
|
|
|
|
As I said in this reply[^] - because the standard says so...
But it's probably to simplify parsing - lord knows C++ (and to a degree, C) parsers need all the help they can get.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
sizeof is not a function. It is an operator.
Just because parenthesis is used does mean that it is a function.
In that case if , switch , while , return etc. can be called functions.
This is a excerpt from MSDN -
The operand to sizeof can be one of the following:
A type name. To use sizeof with a type name, the name must be enclosed in parentheses.
An expression. When used with an expression, sizeof can be specified with or without the parentheses. The expression is not evaluated.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi,
I am working in an application with docking window like Visual Studio 2005 interface. I do it with Visual Studio 2008 and MFC.
The left pane is a CTreeCtrl. I put items in it. When I click on an item, I want to display a form in the view portion of the application.
To do that, I have a member function called void CViewTree::OnTvnSelchanged(NMHDR *pNMHDR, LRESULT *pResult) to catch the event.
To display the form associated with the item clicked, I have to access the view class and after that the document class.
I access the view like that from the CViewTree::OnTvnSelchanged function:
CFrameWnd *pFrameWnd = (CFrameWnd*)AfxGetApp()->m_pMainWnd;
CCDSView* pView;
pView = (CCDSView*)pFrameWnd->GetActiveView();
I get memory leaks, but the program run anyway.
What I can't understand is that the program run under Vista 64 Home premium at home, but not run on an XP computer at office.
I compile it with Net Framework 2.0.
Does it has another way to access the view or document that does not crash my application ?
Thanks,
Claude
|
|
|
|
|
I am working with win32 application. I wanted to copy text using TextOut( ) in to temp DC (not original DC). then after BitBlt( ) copy temp DC in to original DC.
Here is my code please correct it.
case WM_PAINT:
{
HDC hdc;
hdc= CreateCompatibleDC(NULL);
TextOut( hdc,0,0, "Check Text", strlen( "Check Text" ) );
BitBlt(GetDC(hWnd), m_rect.left, m_rect.top, m_rect.right - m_rect.left, m_rect.bottom-m_rect.top,hdc, m_rect.left, m_rect.top, SRCCOPY);
}
|
|
|
|
|
From documentation [^]:
Remarks
A memory DC exists only in memory. When the memory DC is created, its display surface is exactly one monochrome pixel wide and one monochrome pixel high. Before an application can use a memory DC for drawing operations, it must select a bitmap of the correct width and height into the DC. To select a bitmap into a DC, use the CreateCompatibleBitmap function, specifying the height, width, and color organization required.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Modified code:
case WM_PAINT:
{
HDC hdc;
hdc= CreateCompatibleDC(NULL);
HBITMAP hBit = CreateCompatibleBitmap( hdc,m_rect.right- m_rect.left, m_rect.bottom -
m_rect.top );
SelectObject( hdc, hBit );
TextOut( hdc,0,0, "Check Text", strlen( "Check Text" ) );
BitBlt(GetDC(hWnd), m_rect.left, m_rect.top, m_rect.right - m_rect.left, m_rect.bottom-m_rect.top,hdc, m_rect.left, m_rect.top, SRCCOPY);
}
Still the code is not working. Thank You
|
|
|
|
|
zakkas2483 wrote: HBITMAP hBit = CreateCompatibleBitmap( hdc,m_rect.right- m_rect.left, m_rect.bottom -
m_rect.top );
I would use (see, for instance, ... documentation [^] ):
HDC hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
HBITMAP hBit = CreateCompatibleBitmap( hdcScreen,m_rect.right- m_rect.left, m_rect.bottom -
m_rect.top );
CreateCompatibleBitmap( hdcScreen, m_rect.right- m_rect.left, m_rect.bottom -
m_rect.top );
(I don't know if the
CreateCompatibleBitmap( NULL, m_rect.right- m_rect.left, m_rect.bottom -
m_rect.top );
'shortcut' would work).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I have inserted a combo-box control in my project.
In that control vertical scroll bar is present.
I want horizontal scroll bar also.
how to attach horizontal scroll bar to control
thanks
|
|
|
|
|
saksp wrote: I have inserted a combo-box control in my project.
In that control vertical scroll bar is present.
I want horizontal scroll bar also.
how to attach horizontal scroll bar to control
First edit .rc file to add WS_HSCROLL to combo box style codes since dialog does not support this. Then use this function, I've for demo purpose given 600, you need to use GetTextExtent function to get the real extent, look up MSDN for SetHorizontalExtent sample code...
void CDialoTestDlg::AddHScroll()
{
CComboBox* pCmb = (CComboBox*)GetDlgItem(IDC_COMBO_HORZ_EXTENT);
ASSERT( pCmb );
pCmb->SendMessage( CB_SETHORIZONTALEXTENT, 600, 0 );
}
|
|
|
|
|
Hi All,
I have an application in Visual Studio 2003. As a part of the patch updates, I adding a new component built in VS-2005 (which is a dll), to the existing components (built in VS-2003). From my unit testing the new module (dll) seems to work fine and is functioning well i.e. my old application is able to load the dll library dynamically. But i do remember of few C-run time compatibility issues from the past and I am not able to recollect the same.
Could you guys throw some light onto this and let me know any special pre-requisites that i should take care of ?
Thanks for your time.
Sunil
|
|
|
|
|
Hi,
I try to use "Win32_Tpm" to manage TPM in C++, Now i can get some info from TPM by "ExecQuery", but i want to use the class method such as "IsEnabled" by "ExecMethod", it returns error "-2147217361", it maybe means "InvalidMethodParameters "(found in net http://mono.ms.mff.cuni.cz/projects/mono/diffs/showdiff.php?old=2007-10-03&new=2007-10-04&diffIndex=15&bench=
code :
BSTR ClassName = SysAllocString(L"Win32_Tpm");
BSTR MethodName= SysAllocString(L"IsEnabled");
BSTR argname = SysAllocString(L"Request");
hres = pSvc->GetObject(L"Win32_Tpm", 0, NULL, &pclsObj, NULL);
hres = pclsObj->GetMethod(_bstr_t(L"SetPhysicalPresenceRequest"),0, &pInParamsDefinition, NULL);
hres = pInParamsDefinition->SpawnInstance(0, &pClassInstance);
varCommand.vt = VT_BSTR;
varCommand.bstrVal = L"14";
hres = pClassInstance->Put(argname, 0,&varCommand, 0);
hres = pSvc->ExecMethod(ClassName,_bstr_t(L"SetPhysicalPresenceRequest"),0,NULL,pClassInstance,&pTmpclsObj,NULL); ----- return "-2147217361" here
// isEnabled
hres = pSvc->ExecMethod(ClassName,MethodName,0,NULL,NULL,&pTmpclsObj,NULL); ----- return "-2147217361" here
Can somebody help me?
Thank a lot!
Stanley Hwang
|
|
|
|
|
I need to find out the width and height (in pixel/ in any logical unit) of a string.
I am using GetTextExtentPoint32() API to calculate the string size. But it is observed that the GetTextExtentPoint32() is giving me the different size , if execute my application on different language OS. After some analysis it is observed that font size and font face value is affecting the size of a string, so i have set the font face and font size to the DC.But still due to different CHARSET value available on different language OS i am getting different size of a string. Please let me know how to handle this issue, so that i can get same value of a string (string from any language) for different language OS.
I wrote the method as below:
LPSIZE lpSize = new SIZE () ;
void MyAPI( CString szLangStr , lpSize )
{
....
}
So the expected out put the width and height of szLangStr and which should be same for all the language OS.
|
|
|
|
|
Cannot you just be prepared to deal with different string sizes?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
pandit84 wrote: Please let me know how to handle this issue, so that i can get same value of a string (string from any language) for different language OS.
I really doubt if this is possible. There will be a lot of variation between fonts, and user preferences may come into it as well.
As noted in the previous reply, you're much better designing your app to handle different sizes of string.
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Did you not just ask this same question 9 minutes ago?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Noooooo - he's asking about string width AND height now, not just width
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|