|
i have an error on direct x using visual c++. when i try to use keyboard event.
*****************************************************
missing ';' before identifier 'DInput'
keyboard eve\main.cpp(13) : error C2501: 'LPDIRECTINPUT8' : missing storage-class or type specifiers
keyboard eve\main.cpp(13) : fatal error C1004: unexpected end of file found
*******************************************************
i think it from including dinput.h although i include it on my program.
please help me!!
|
|
|
|
|
Hello!
I'm developping a MDI application in MS Visual C++ .NET (Managed C++ and GUI-Designer).
As my child windows are of dialog style (3D border and grey), I looked for a way to remove the inside 3D border of the MDI child area while the child windows are maximized and to put the border back on if they are normalized again.
All this because it doesn't look very nice when you maximize a 3D bordered window in another 3D bordered window (you get a "double border" then).
See these pictures illustrating what I mean:
Normal child window:
http://www.geocities.com/icklephilipp/ura_situation1.gif
Maximized child window with "double border":
http://www.geocities.com/icklephilipp/ura_situation2.gif
Maximized child window with merged border (this is what it should look like):
http://www.geocities.com/icklephilipp/ura_situation3.gif
I did manage to remove the 3D border with this code:
To remove the border:
System::Void MainForm::AddClientEdge(System::Windows::Forms::MdiClient* mdi)
{
if (mdi != NULL) {
int style = GetWindowLong((HWND)mdi->Handle.ToPointer(), GWL_STYLE);
int exStyle = GetWindowLong((HWND)mdi->Handle.ToPointer(), GWL_EXSTYLE);
style &= ~WS_BORDER;
exStyle |= WS_EX_CLIENTEDGE;
SetWindowLong((HWND)mdi->Handle.ToPointer(), GWL_STYLE, style);
SetWindowLong((HWND)mdi->Handle.ToPointer(), GWL_EXSTYLE, exStyle);
SetWindowPos((HWND)mdi->Handle.ToPointer(), (HWND)IntPtr::Zero.ToPointer(), 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
}
} To put the border back on:
System::Void MainForm::RemoveClientEdge(System::Windows::Forms::MdiClient* mdi)
{
if (mdi != NULL) {
int style = GetWindowLong((HWND)mdi->Handle.ToPointer(), GWL_STYLE);
int exStyle = GetWindowLong((HWND)mdi->Handle.ToPointer(), GWL_EXSTYLE);
style &= ~WS_BORDER;
exStyle &= ~WS_EX_CLIENTEDGE;
SetWindowLong((HWND)mdi->Handle.ToPointer(), GWL_STYLE, style);
SetWindowLong((HWND)mdi->Handle.ToPointer(), GWL_EXSTYLE, exStyle);
SetWindowPos((HWND)mdi->Handle.ToPointer(), (HWND)IntPtr::Zero.ToPointer(), 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
}
} The big problem now occurring is shown in this picture:
http://www.geocities.com/icklephilipp/ura_strange.gif
The menubar of the main window changes like this if one switches between different child windows via the "Window" menu while the child windows are maximized.
Does anyone know, what relation these two functions have in particular?
I don't get it at all!
I'm grateful for any ideas or thoughts!
Greets, icklePhil
|
|
|
|
|
Finally I solved the problem myself:
I needed to override the WndProc function of the child form and catch the WM_SYSCOMMAND message there. WM_SYSCOMMAND has in its wParam value one of the values SC_MAXIMIZE, SC_RESTORE, SC_MINIMIZE, or others. With this I can fire my own maximizing/minimizing/restoring events! These don't interfer with the child form switching.
Sample code:
void WndProc(Message* m)
{
if (m->Msg == WM_SYSCOMMAND) {
switch (m->WParam.ToInt32()) {
case SC_MAXIMIZE:
ConnectionFormMaximizeEvent(this, new System::EventArgs());
break;
case SC_RESTORE:
ConnectionFormRestoreEvent(this, new System::EventArgs());
break;
case SC_MINIMIZE:
ConnectionFormMinimizeEvent(this, new System::EventArgs());
break;
}
}
else if (m->Msg == WM_NCLBUTTONDBLCLK) {
ConnectionFormMaximizeEvent(this, new System::EventArgs());
}
__super::WndProc(m);
}
Note:
You will need some header file(s) from Win api that define(s) the WM_... and SC_... constants.
But I don't remember which one right now.
Bye, icklePhil
|
|
|
|
|
Is there any way to get the browser name ,using the CHtmlView Class or otherwise
thank you
|
|
|
|
|
To get the default browser associated with .htm or .html extensions, use FindExecutable() or AssocQueryString() .
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi,
I'm working on a MIPS disassembler/assembler. When I compile my code I got stupid error. I can't figure out what is wrong. Please Help.
Definitions.h
<br />
#pragma once<br />
#include <stdio.h><br />
#ifndef __DEFINITIONS_H__<br />
#define __DEFINITIONS_H__<br />
<br />
#ifdef __MSVC__<br />
typedef unsigned __int64 dword;<br />
typedef unsigned __int32 word;<br />
typedef unsigned __int16 hword;<br />
typedef unsigned __int8 byte;<br />
#else<br />
typedef unsigned int word;<br />
typedef unsigned short hword;<br />
typedef unsigned char byte;<br />
#endif<br />
<br />
#ifndef NULL<br />
#define NULL 0<br />
#endif<br />
<br />
#ifndef true<br />
#define true 1<br />
#endif<br />
<br />
#ifndef false<br />
#define false 0<br />
#endif<br />
<br />
typedef struct<br />
{<br />
unsigned offset :16;<br />
unsigned ft :5;<br />
unsigned base :5;<br />
unsigned opcode :6;<br />
} Inst_FPU_IType;<br />
<br />
typedef struct<br />
{<br />
unsigned function :6;<br />
unsigned fd :5;<br />
unsigned fs :5;<br />
unsigned ft :5;<br />
unsigned fmt :5;<br />
unsigned opcode :6;<br />
} Inst_FPU_RType;<br />
<br />
typedef struct <br />
{<br />
unsigned opcode :6;<br />
unsigned sub :5;<br />
unsigned rt :5;<br />
unsigned fs :5;<br />
unsigned imm :11;<br />
} Inst_FPU_JType;<br />
<br />
typedef struct <br />
{<br />
unsigned function :6;<br />
unsigned sa :5;<br />
unsigned rd :5;<br />
unsigned rt :5;<br />
unsigned rs :5;<br />
unsigned opcode :6;<br />
} Inst_CPU_RType;<br />
<br />
typedef struct <br />
{<br />
<br />
unsigned immediate :16;<br />
unsigned rt :5;<br />
unsigned rs :6;<br />
unsigned opcode :6;<br />
} Inst_CPU_IType;<br />
<br />
typedef struct <br />
{<br />
unsigned inst_index :26;<br />
unsigned opcode :6;<br />
} Inst_CPU_JType;<br />
<br />
typedef union<br />
{<br />
Inst_CPU_RType RType;<br />
Inst_CPU_IType IType;<br />
Inst_CPU_JType JType;<br />
word Special;<br />
} OPCODE;<br />
#define WORD2OPCODE(x) *(OPCODE*)&(x)<br />
<br />
#define INSTR_TYPE_DATA_WORD 0<br />
#define INSTR_TYPE_CPU_ITYPE 1<br />
#define INSTR_TYPE_CPU_JTYPE 2<br />
#define INSTR_TYPE_CPU_RTYPE 3<br />
<br />
#pragma warning(disable : 4996)<br />
<br />
<br />
typedef struct<br />
{<br />
char Name[5];<br />
byte No;<br />
} Register;<br />
<br />
const Register RegTable[] =<br />
{<br />
{"zero", 0},<br />
...<br />
{"ra", 31},<br />
};<br />
#define REGISTER_COUNT 31<br />
<br />
typedef struct<br />
{<br />
char Name[10];<br />
word OpcodeMask;<br />
word FieldMask;<br />
char Syntax[15];<br />
} Instruction;<br />
<br />
const Instruction InstTable[] = <br />
{<br />
{"addi", 0x20000000, 0xFC000000, "$t, $s, i"},<br />
....<br />
{"xor", 0x00000026, 0xFC00003F, "$d, $s, $t"},<br />
};<br />
#define INSTRUCTION_COUNT 49<br />
<br />
<br />
#endif<br />
Disassembler.hpp
<br />
#ifndef __DISASSEMBLER_HPP__<br />
#define __DISASSEMBLER_HPP__<br />
#include "definitions.h"<br />
#pragma warning( disable : 4290 )<br />
<br />
#define DISASSEMBLER_ERROR_WARNING 0<br />
#define DISASSEMBLER_ERROR_ERROR 1<br />
#define DISASSEMBLER_ERROR_INTERNAL 2<br />
<br />
typedef struct<br />
{<br />
word Type;<br />
char Text[250];<br />
} DisassemblerErrorDesc;<br />
<br />
const DisassemblerErrorDesc DisassemblerErrors[] =<br />
{<br />
{DISASSEMBLER_ERROR_INTERNAL, "No such a register"},<br />
{DISASSEMBLER_ERROR_INTERNAL, "Instruction table parameter syntax error"},<br />
{DISASSEMBLER_ERROR_ERROR, "There is no such a instruction"},<br />
};<br />
#define ASSEMBLER_ERROR_COUNT 6<br />
#define BUFFER_CHUNK_SIZE sizeof(char) * 200<br />
<br />
class CDisassembler<br />
{<br />
private :<br />
friend int main(char** argv, int argc);<br />
void (*SendOutput)(char* Text);<br />
void (*SendError)(char* Text, word Pos, word Item);<br />
<br />
bool RaiseError(word err, word pos, word opcode);<br />
inline void Hex(word number, char *buffer);<br />
inline char* DecodeRegister(byte id) throw (int);<br />
void DecodeParam(Instruction inst, OPCODE opcode, char *buffer) throw(int);<br />
inline void ManageMemory(char *&buffer, word size, word bufferpos, word &buffersize) throw(int);<br />
void DecodeOpcode(word opcode, char* buffer) throw(int);<br />
public:<br />
char* Disassemble(word* binary, word size);<br />
CDisassembler();<br />
CDisassembler(void (*Output)(char*), void (*Error)(char*, word, word));<br />
~CDisassembler();<br />
};<br />
<br />
#endif<br />
Here is my error output:
------ Build started: Project: Disassembler, Configuration: Debug Win32 ------
Compiling...
main.c
c:\projects\disassembler\disassembler.hpp(24) : error C2061: syntax error : identifier 'CDisassembler'
c:\projects\disassembler\disassembler.hpp(24) : error C2059: syntax error : ';'
c:\projects\disassembler\disassembler.hpp(25) : error C2449: found '{' at file scope (missing function header?)
c:\projects\disassembler\disassembler.hpp(42) : error C2059: syntax error : '}'
Build log was saved at "file://c:\Projects\Disassembler\Debug\BuildLog.htm"
Disassembler - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
As you can see I'm having error at
class CDisassembly
{
code. What is wrong with this very basic statement. I have scanned the above lines for a syntax error but found nothing. Have any idea ?
Thanks a lot.
-- modified at 4:35 Thursday 15th December, 2005
|
|
|
|
|
i don't know what's wrong, but the error is in disassembler.hpp, around line 24, so i don't understand why you gave the whole code of definition.h
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
Thanks for your reply.
I have included definitions.h in disassembler.hpp so that source of this error can be in definitions.h. In my past experiences precompiler directives can be source of errors like this. Especially included files. Some times I had extra ';' token at the end of a header file and I got errors similar to this error in file that included the header file.
I thought that maybe I have error in definitions.h.
I gonna be crazy. What the heck is this error ?!? It's so simple statement.
-- modified at 4:25 Thursday 15th December, 2005
|
|
|
|
|
What is that #include doing in begining of definitions.h?I dont know much about programing but i think you should include something, like file?Could that be problem?
|
|
|
|
|
Sorry I think there is a copy/paste problem. that line should be #include <stdio.h> I'm gone fix the post.
Thans a lot for your reply...
|
|
|
|
|
|
You could run the code through the preprocessor (only) and examine the output.
That's one way...
|
|
|
|
|
How can I do it ?
Thanks for your reply.
|
|
|
|
|
|
thans a lot. I'll try it.
|
|
|
|
|
Good luck.
The output from the preprocessor isn't very good looking, but it's what the compiler gets.
Kakan
|
|
|
|
|
I think you are getting these error messages because you are including a C++ header file and a class in a .C file. The file which is including the .HPP file must be a .CPP file.
this is this.
|
|
|
|
|
It worked !
I have included this file in main.c.
Now I renamed it to main.cpp and compiled the solution. It works.
Thanks a lot for your help.
|
|
|
|
|
Ametal wrote: Compiling...
main.c
Should this be main.cpp instead?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I want to change the name of my application to appear at the top of my screen.
I am using a menu which call many Views, one at time.
When i open the program, the New name appear and when a shift to another view, the new name disapear.
Where can I fix it so that it cann't change
I learn my self
|
|
|
|
|
|
Your Are right,
I try it, it's work well
Thanks for all
Best new year for you and your familly
|
|
|
|
|
Hi,
I create template class, declared in .h file and implemented in .cpp file. But it do not compile the functions in the .cpp file.
But when I put them in the .h file, it's OK.
The .cpp file is in the source files list.
I use VC 6.
Thank you.
- NS -
|
|
|
|
|
Is it possible to send the errors or the files ?
I think that you got linker error when you had tried to compile.
|
|
|
|
|
Yes. Linker error for only those functions used.
- NS -
|
|
|
|
|