|
Your Laptop class does not inherit Computer , so you cannot call it in that way. Your definition should be:
class Laptop : Computer
{
|
|
|
|
|
Hi all,
I'm trying to use ATL(no mfc support) to develop a activex component used in IE, and I want to design UI like common windows including menu, view window and status bar, but all article I searched from web always use dialog style, no related article for my problem.
Also, I have the code generated by wizard, Within my com component, I have the code block below:
CContainedWindow m_ctlStatic;
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
CHAIN_MSG_MAP(CComControl<CUniDocCtrl>)
ALT_MSG_MAP(1)
END_MSG_MAP()
also, the OnCreate code is below:
LRESULT OnCreate(UINT , WPARAM , LPARAM , BOOL& )
{
RECT rc;
GetWindowRect(&rc);
rc.right -= rc.left;
rc.bottom -= rc.top;
rc.top = rc.left = 0;
m_ctlStatic.Create(m_hWnd, rc);
return 0;
}
My idea is to replace the
m_ctlStatic.Create(m_hWnd, rc); with my own windows create function and add menu, code is below:
m_ctlStatic.Create(m_hWnd, rc, _T("hello"), WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_AUTOVSCROLL);
HMENU hmenu;
hmenu = LoadMenu(g_hModule,MAKEINTRESOURCE(IDR_MENU1));
m_ctlStatic.SetMenu(hmenu);
It doesn't work at all, and also it jump to base method which display the "ALT 10.0" text.
how to solve this problem, thanks in advance.
|
|
|
|
|
Hello
I have an application made with VC++ that can show a lot of dialogs. Those dialogs have been defined in an RC file and contains ActiveX controls made with Visual Basic 6.
My promen is the following one:
I have compiled the application in 64 bits, and when I launch the application and it is going to show a dialog, it fails. I think this is due to there is not 64 bits runtime for VB6.
What I want it is to generate an equivalent RC file to the RC file I have but replacing the controls made with VB6 with others made with VC++.
The obvious way is to edit the dialogs with Visual Studio C++ resource editor, and replace each control with its equivalent control. The problem is that I have a lot of dialogs (about 1000).
Is there a easy way to do this?
A possible way could be to generate an application that load the dialogs, and replace the controls during the execution, and then generate and RC file with the resultant dialogs. Something similar to what makes Visual Studio C++ resource editor.
I have tried to implement this solution, but I don't find the way to generate an RC file from a dialog loaded during the application execution.
Any help will be appreciated,
Best regards.
|
|
|
|
|
I assume that the original 32-bit code used VB6-specific control elements, that the source code (text) for the RC file is unavailable, and that you are familiar with the .RC (source code for resources) file format.
To my knowledge, there is no fully automated method of performing the conversion. What you must do is the following:
- Extract the resources from the .EXE file using a resource file editor.
I have used ResEdit (freeware) for examining resources in EXE files. IIRC, it can also extract resources from an EXE/DLL. - Convert any VB6-specific elements to generic Windows versions
Each dialog etc. specifies its "class" type, which affects how it is displayed. This includes the DLL that must be loaded in order to display it. Convert any VB6-specific names to the generic equivalent (e.g. "VB6button" should be renamed "button", "VB6dialog" should be renamed "dialog", etc.) - EDIT: Some ActiveX controls may have no generic control that can replace them. In this case, you must decide whether to use a class library that supplies the missing functionality, or eliminate them from the file.
- Recompile the RC file using the Visual Studio resource editor.
You should get an application that has standard dialog boxes. It will presumably require lots of tweaking before the layout etc. looks OK, but it is a good starting point.
Good luck!
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
As much as I understand:
Non-MFC projects / Projects with ATL support use CString via atlstr.h
MFC projects use CString via cstringt.h
They are source-code compatible, bbut not link time compatible; so if I have a static library that does use CString and that I want to use in both an MFC and a non-MFC project, I have to build the library in two configurations - with / without MFC support.
Is there any sane way to build the library and link it to both MFC and non-MFC projects?
|
|
|
|
|
Remove the CString dependency (i.e. use std::string or something else)... as easy CString is to use, they sure jumbled things up by essentially including it in two places (which is what I assume the link time portion means). Now, I am assuming that's what they mean by "not being link-time compatible" means. You can verify by using a tools to look for the CString symbols in either library (in linux you'd use the "nm" utility, there must be a Windows equivalent but not sure of the name).
|
|
|
|
|
i am getting error
error : expected unqualified-id
public ref class Form1 : public System::Windows::Forms::Form
^
error : expected unqualified-id
[STAThreadAttribute]
^
error : use of undeclared identifier 'STAThreadAttribute'
[STAThreadAttribute]
^
3 errors generated.
i am using clang compiler to build the project
what could be the possible reasons for this? How could I solve this?
thanks
|
|
|
|
|
Check the preceding lines to see if there is an incomplete statement.
|
|
|
|
|
there is only pragma and namespace above the error-ed public keyword-
#pragma once
namespace test4 {
namespace System{};
namespace System{namespace ComponentModel{}};
namespace System{namespace Collections{}};
namespace System{namespace Windows{namespace Forms{}}};
namespace System{namespace Data{}};
namespace System{namespace Drawing{}};
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
error is not shown above the public keyword
I had replaced-
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
with
namespace System{};
namespace System{namespace ComponentModel{}};
namespace System{namespace Collections{}};
namespace System{namespace Windows{namespace Forms{}}};
namespace System{namespace Data{}};
namespace System{namespace Drawing{}};
because i was getting error with the first one.
|
|
|
|
|
Those changes are completely wrong. You have removed the using keywords, and added lots of unnecessary brace characters. I suggest you create a new clean Form project from the Visual Studio templates.
|
|
|
|
|
Hi,
If I use using then I get the following errors-
error : expected namespace name
using namespace System; ^
error : use of undeclared identifier
using namespace System::ComponentModel;
^
error : expected namespace name
using namespace System::ComponentModel;
^
error : use of undeclared identifier
using namespace System::Collections;
^
and so on....including buttons...
So, I used the namespace with curly braces{} suggested somewhere on the net
Using that I don't get these errors but then I have trouble with Public keyword.
what can I do? Is clang compiler doing this?
|
|
|
|
|
VScoder12 wrote: So, I used the namespace with curly braces{} suggested somewhere on the net Don't. Using information from the internet without knowing what you are doing is not the way to get your program to work.
I am beginning to suspect that you are not using the CLR option on your project, so the compiler thinks this is unmanaged C++. Check your settings again.
|
|
|
|
|
I used Visual C++ > CLR > Windows Forms Application in my project creation
I think it is not recognizing the System namespace
If I use curly braces i think it recognizes System namespace but then it does not recognize the Private keyword
any suggestion?
|
|
|
|
|
VScoder12 wrote: any suggestion? Not really. I have just created a new Windows Forms application using Visual C++ 2010 Express, and it creates the correct files, and compiles without error. I can only assume that something is missing from your Visula Studio setup that causes these errors. The generated code of the two main files is as follows, you could try it in your system.:
#pragma once
namespace WinForm {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
protected:
~Form1()
{
if (components)
{
delete components;
}
}
private:
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
void InitializeComponent(void)
{
this->components = gcnew System::ComponentModel::Container();
this->Size = System::Drawing::Size(300,300);
this->Text = L"Form1";
this->Padding = System::Windows::Forms::Padding(0);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
}
#pragma endregion
};
}
#include "stdafx.h"
#include "Form1.h"
using namespace WinForm;
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Application::Run(gcnew Form1());
return 0;
}
|
|
|
|
|
if i use win32 then mine also compile and runs successfully
but i am having trouble with compiling/building with clang compiler as mentioned earlier
|
|
|
|
|
Clang doesn't support C++/CLI, while Microsoft's compilers do. That's the issue.
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
VScoder12 wrote: clang compiler What is that, and what does it have to do with Visula Studio?
|
|
|
|
|
Clang Compiler[^]
An open-source compiler.
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Yeah, I missed the significance of that in the opening question.
|
|
|
|
|
|
I implemented a multi language UI in a MFC program, since only a few controls, so I write translation in code, I knew it can be implemented with DLL, or String Table.
Now I wonder what way is better, in code, string table, or DLL,according to run time performance and space consuming.
|
|
|
|
|
If your program isn't huge, no reason to do this in an external library, that would definitely be the slowest and most (disk) space consuming method.
I'd say string table would probably be fast, and as long as you don't have too many strings, it shouldn't be too costly. If you have a huge number of strings, you may start using up quite a bit of memory to support this, then the library method starts to become more appealing.
|
|
|
|
|
Hello everyone,
I meet a crash problem. just as following, I donot know why IsWindow will crash,
Is there anyone meet the same problem?
AULTING_IP:
user32!IsWindow+1a
761a7150 8365fc00 and dword ptr [ebp-4],0
EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 761a7150 (user32!IsWindow+0x0000001a)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 00000001
Parameter[1]: fffffffc
Attempt to write to address fffffffc
ChildEBP RetAddr Args to Child
06f9ff48 72d229bb 04e73a50 6928d287 00000000 user32!IsWindow+0x1a
06f9ff80 72d22a47 00000000 7710338a 04e74990 msvcr80!_callthreadstartex+0x1b [f:\sp\vctools\crt_bld\self_x86\crt\src\threadex.c @ 348]
06f9ff88 7710338a 04e74990 06f9ffd4 776b9f72 msvcr80!_threadstartex+0x66 [f:\sp\vctools\crt_bld\self_x86\crt\src\threadex.c @ 326]
06f9ff94 776b9f72 04e74990 70af11ab 00000000 kernel32!BaseThreadInitThunk+0xe
06f9ffd4 776b9f45 72d229e1 04e74990 00000000 ntdll!__RtlUserThreadStart+0x70
06f9ffec 00000000 72d229e1 04e74990 00000000 ntdll!_RtlUserThreadStart+0x1b
|
|
|
|
|
Please show the code that causes the error, it looks as if you are passing a bad parameter to some windows function.
|
|
|
|
|
Further questions:
- the window handle you feed into IsWindow: is it a handle inside your application or a different window?
- is your application running elevated?
- is the other application running elevated?
- are there differences in 32 vs. 64bit architecture between the applications?
|
|
|
|