|
compare the settings in debug and release configs
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
I had a series of #ifdef that were somehow impeding the compilation, There must be a conflict, but it does not explain differences between release and debug. Disabling these, as below, fixes the problem
#if 0
// Allow use of features specific to Windows 95 and Windows NT 4 or later.
#ifndef WINVER
#define WINVER 0x0400
#endif
// Allow use of features specific to Windows NT 4 or later.
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0500
#endif
// Allow use of features specific to Windows 98 or later.
#ifndef _WIN32_WINDOWS
#define _WIN32_WINDOWS 0x0410
#endif
ES
// Allow use of features specific to IE 4.0 or later.
#ifndef _WIN32_IE
#define _WIN32_IE 0x0400
#endif
#endif
|
|
|
|
|
// Allow use of features specific to Windows 95 and Windows NT 4 or later.
#ifndef WINVER
#define WINVER 0x0500 <----------------- CHANGE HERE from 0x0400 to 0x0500 TO FIX PROBLEM
#endif
|
|
|
|
|
I had the same problem and changing the WINVER in stdafx worked for me.
|
|
|
|
|
|
Hi, how to differentiate a floppy drive and a USB drive in VC++ , i used GetDriveType and both have REMOVABLE property , and can some one explain how exactly to use "SetupDiGetDeviceRegistryProperty" to determine whether it's USB or FLOPPY
|
|
|
|
|
This[^] thread might help.
|
|
|
|
|
you could also use windows registry entry and settings to fetch values for hardware devices.
|
|
|
|
|
You can issue the IOCTL_STORAGE_GET_MEDIA_TYPES_EX to differentiate.
Here is an example code:
DWORD dwOutBytes;
HANDLE hDevice = CreateFile(_T("\\\\.\\A:"), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hDevice != INVALID_HANDLE_VALUE)
{
DEVICE_MEDIA_INFO dmi;
DeviceIoControl(hDevice,
IOCTL_STORAGE_GET_MEDIA_TYPES_EX,
NULL, 0,
&dmi, sizeof(dmi),
dwOutBytes,
NULL);
if ((MEDIA_TYPE)dmi.RemovableDiskInfo.MediaType == RemovableMedia)
{
}
else
{
}
}
CloseHandle(hDevice);
Hope it is useful to you.
|
|
|
|
|
Hello
It's a maze program,but is not completed. I want to define move function to move the ** (worm). when I ask the value of arrow_keys() it has no response(see move function) in other word move function doesn't work(it is not completed).
#include <stdio.h>
#include <conio.h>
create_wall();
arrow_keys();
move();
void main()
{
create_wall();
arrow_keys();
move();
}
create_wall(){
clrscr();
int i,j;
char wall[15][26]={
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,1,1,1,0,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1},
{1,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,1},
{1,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,1},
{1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1},
{1,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,0,1,1,0,1},
{1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1},
{1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,1,0,0,0,1,1,0,1},
{1,0,1,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,1,1,1,1,1,1,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1,0,1},
{1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1},
{1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,1,0,0,0,1,1,0,1},
{1,0,1,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
};
for(i=0;i<15;i++){
for(j=0;j<26;j++){
if (wall[i][j]==1) printf("²");
else printf(" ");
}
printf("\n");
}
gotoxy(2,2);
printf("*");
gotoxy(3,2);
printf("*");
}
int arrow_keys()
{
int ch;
while(1)
{
ch=getch();
if(ch==0)
{
ch=getch();
if(ch==72) return 72;
if(ch==75) return 75;
if(ch==77) return 77;
if(ch==80) return 80;
}
else break;
}
}
move(){
if (arrow_keys()==75)
{
clrscr();
printf("bvccvbncvnvbnvb");
}
}
|
|
|
|
|
Only by reading the input keys, **(worm) will not move, for that you need to add some code here
if (arrow_keys()==75)
{
}
Don't die, until you do.
http://nnhamane.googlepages.com
|
|
|
|
|
if i understood it correctly, your problem is that, you are unable to scan the keys Right??.
i dont think getch will do for you here in this context.
there is some other mechanism to get the key code here.
let me refer my backups and let you know.
parallelly, you can also try it.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
hasani2007 wrote: when I ask the value of arrow_keys() it has no response...
Possibly because not every logic path has a return value. If the first getch() returns a non-zero value, the while() loop breaks and arrow_keys() will return what?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hello hasani2007.
Nice work on the maze.
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#define UP 72
#define DOWN 80
#define LEFT 75
#define RIGHT 77
#define SPACE 32
#define ENTER 13
#define ESCAPE 27
typedef struct t_worm
{ int x,y,dirx,diry; } ;
t_worm worm;
int ch;
int i,j;
char wall[15][26]={
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,1,1,1,0,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1},
{1,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,1},
{1,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,1},
{1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1},
{1,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,0,1,1,0,1},
{1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1},
{1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,1,0,0,0,1,1,0,1},
{1,0,1,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,1,1,1,1,1,1,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1,0,1},
{1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1},
{1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,1,0,0,0,1,1,0,1},
{1,0,1,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
};
void create_wall();
void arrow_keys();
void move();
void clrscr();
void gotoxy(int x, int y);
void main()
{
create_wall();
while(ch!=ESCAPE)
{
arrow_keys();
move();
}
gotoxy(1,21);printf("\n");
}
void create_wall(){
clrscr();
for(i=0;i<15;i++){
for(j=0;j<26;j++){
if (wall[i][j]==1) printf("²");
else printf(" ");
}
printf("\n");
}
gotoxy(2,2);
printf("*");
gotoxy(3,2);
printf("*");
}
void arrow_keys()
{
if (kbhit())
{
ch=getch();
switch (ch)
{
case UP:
worm.y--;
break;
case DOWN:
worm.y++;
break;
case LEFT:
worm.x--;
break;
case RIGHT:
worm.x++;
break;
}
}
}
void move()
{
gotoxy(worm.x,worm.y);printf("*");
}
void clrscr()
{
COORD coordScreen = { 0, 0 };
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD dwConSize;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsole, &csbi);
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten);
GetConsoleScreenBufferInfo(hConsole, &csbi);
FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
SetConsoleCursorPosition(hConsole, coordScreen);
return;
}
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x; coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
return;
}
..
modified on Wednesday, June 2, 2010 9:55 AM
|
|
|
|
|
I am working on transcoding using ffmpeg.For that,i have one class decoder for decoding purpose.That file name is video_decoder.h.
Inside this file,im using the ffmpeg header files as
extern "C"
{
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
};
And,Im using the functions of this decoder class in my existing class say FileWriter.This file name is Video_Writer.h.
so,i have included video_decoder.h in video_writer.cpp file.And ofcourse,video_writer.h also there.The problem starts here.
Inside video_writer.h the variable type int8_t is defined in <lib_mp4v2\mpeg4ip_win32.h>.
Also,Inside video_decoder.h the same variable type int8_t is defined in stdint.h.
So,the compile time error is coming as
e:\workspace\build_recorder_plugins.root\build_recorder_plugins\include\stdint.h(82) : error C2371: 'int8_t' : redefinition; different basic types
e:\workspace\build_recorder_plugins.root\build_recorder_plugins\_build\include\lib_mp4v2\mpeg4ip_win32.h(52) : see declaration of 'int8_t'
Pls help me to solve this..
|
|
|
|
|
You've got a couple of choices...
The first one is to work out if the types are compatible and if they are just use one of the definitions (presumably the one from stdint.h).
If you can't do that then isolate the includes from each other behind interfaces. This might not be a bad idea as you won't be using the third party libraries directly and if you ever need to swap them out you can do it far easier. Have a search for the facade pattern online, that's the sort of thing (or pair of things) you need here.
Cheers,
Ash
|
|
|
|
|
Facade pattern can be used in same namespace..am i right?here,Video_writer.h and video_decoder.h are in different namespaces.how can i solve?Is facade pattern useful in this situation?
|
|
|
|
|
The first thing to do is eliminate any usage of those two libraries in the interfaces of your classes. Then make sure you only depend on one of the libraries in the implementation of each class. This provides the facade behind which it doesn't matter how int8_t is defined.
So hide the video stream format stuff behind one class, your decoder behind another:
video_decoder ---> libavdecoder
|
|
|
\--> video_format ---> libavformat
---> means "depends on"
No single implementation file needs to include both avdecoder.h and avformat.h.
Anyway, the point is this lot will work however you package your classes, whether in a namsepaces or not. It doesn't matter.
Also, as a couple of general points:
- don't stick class implementations in header files
- only include header files that contain types that are used in the interface of a class in a header file
This reduces the sort of problems you're having no end.
Cheers,
Ash
|
|
|
|
|
How to block port using programing . suppose any port 8080 of any computer
Trioum
|
|
|
|
|
My application is having one Main window. Which has two child windows. I am showing the child windows side by side.Once if we scroll any of the child windows scrollbar. Both should scroll together.
Please let me know if you have any idea.
Thanks in advance
|
|
|
|
|
Whenever a scroll operation happens in a child window, the window will receive a WM_HSCROLL or WM_VSCROLL message depending on what scroll operation is done.
To make the other child window also do the similar scroll operation you could propogate the same scroll message to the other child window from the WM_HSCROLL or WM_VSCROLL handler using PostMessage .
|
|
|
|
|
The trouble with forwarding messages to another window is what happens (as in the questioners case) if that window has the same behaviour? Each window will send WM_*SCROLL back and forth until someone gets bored.
Cheers,
Ash
|
|
|
|
|
The lParam for these messages are there to handle this situation.
|
|
|
|
|
Good point, I forgot about the NULL lParam,
Cheers,
Ash
|
|
|
|
|
Thanks.. It was really helpfull
|
|
|
|
|