|
Thank you for your replies.
Regards,
sdancer75
|
|
|
|
|
What is callback function [CALLBACK EXPORT] ,how it works , is it infinite loop or recursive. I have a piece of code in vc++ 6.0 can any body explain how it works.
timer_result=SetTimer(NULL,1,(t*1000),Timerflow); //say t=2,or t=10,
===
void CALLBACK EXPORT Timerflow(HWND hWnd, UINT nMsg, UINT nIDEvent, DWORD dwTime)
{
----
----
}
|
|
|
|
|
See [^].
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]
|
|
|
|
|
Missed out the subtle hammering home of the point by not using www.lmgtfy.com.... I do likes that site!
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Fixed [^].
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]
|
|
|
|
|
jiya-123 wrote: I have a piece of code in vc++ 6.0 can any body explain how it works.
Timerflow is a pointer to the function that gets notified (i.e., gets called back) when the time-out value elapses.
"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
|
|
|
|
|
|
Could you please look at the complete compiler output (i.e. what is the source file being compiled, etc..)?
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]
|
|
|
|
|
Yes. It's window.cpp file the particular error occured. The function eventMouseDown is declared in its own header file(window.h). I've included window.h to window.cpp. I've also included the folder containing window.h to Tools->Options->VC++ Directories->Include. What should I do to resolve this error?
|
|
|
|
|
Could you please post:
- the
window.h relevant code (i.e. function prototype) - the
window.cpp relevant code (i.e. function definition) ?
BTW I would also try changing the header name (for instance mywindow.h ).
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]
|
|
|
|
|
Here is window.cpp
#include "window.h"
#include <iostream>
#include <stdexcept>
#include <cassert>
#include <cctype>
#include "conversion.h"
#include "platform_util.h"
#include "leak_dumper.h"
#include "sdl_private.h"
#include "noimpl.h"
#include "sdl_events.h"
#include "sdl_timer.h"
#include "sdl_video.h"
#include "properties.h"
using namespace Shared::Util;
using namespace std;
namespace Shared{ namespace Platform{
static Window* global_window = 0;
Window::Window() {
memset(lastMouseDown, 0, sizeof(lastMouseDown));
assert(global_window == 0);
global_window = this;
}
Window::~Window() {
assert(global_window == this);
global_window = 0;
}
bool Window::handleEvent() {
SDL_Event event;
while(SDL_PollEvent(&event)) {
try {
switch(event.type) {
case SDL_QUIT:
return false;
case SDL_MOUSEBUTTONDOWN:
global_window->handleMouseDown(event);
break;
case SDL_MOUSEBUTTONUP: {
global_window->eventMouseUp(event.button.x,
event.button.y,getMouseButton(event.button.button));
break;
}
case SDL_MOUSEMOTION: {
MouseState ms;
ms.leftMouse = (event.motion.state & SDL_BUTTON_LMASK) != 0;
ms.rightMouse = (event.motion.state & SDL_BUTTON_RMASK) != 0;
ms.centerMouse = (event.motion.state & SDL_BUTTON_MMASK) != 0;
global_window->eventMouseMove(event.motion.x, event.motion.y, &ms);
break;
}
case SDL_KEYDOWN:
if(event.key.keysym.sym == SDLK_RETURN
&& (event.key.keysym.mod & (KMOD_LALT | KMOD_RALT))) {
toggleFullscreen();
}
global_window->eventKeyDown(getKey(event.key.keysym));
global_window->eventKeyPress(static_cast<char>(event.key.keysym.unicode));
break;
case SDL_KEYUP:
global_window->eventKeyUp(getKey(event.key.keysym));
break;
}
} catch(std::exception& e) {
std::cerr << "Couldn't process event: " << e.what() << "\n";
}
}
return true;
}
string Window::getText() {
char* c = 0;
SDL_WM_GetCaption(&c, 0);
return string(c);
}
float Window::getAspect() {
return static_cast<float>(getClientH())/getClientW();
}
void Window::setText(string text) {
SDL_WM_SetCaption(text.c_str(), 0);
}
void Window::setSize(int w, int h) {
this->w = w;
this->h = h;
Private::ScreenWidth = w;
Private::ScreenHeight = h;
}
void Window::setPos(int x, int y) {
if(x != 0 || y != 0) {
NOIMPL;
return;
}
}
void Window::minimize() {
NOIMPL;
}
void Window::setEnabled(bool enabled) {
NOIMPL;
}
void Window::setVisible(bool visible) {
NOIMPL;
}
void Window::setStyle(WindowStyle windowStyle) {
if(windowStyle == wsFullscreen)
return;
}
void Window::create() {
}
void Window::destroy() {
SDL_Event event;
event.type = SDL_QUIT;
SDL_PushEvent(&event);
}
void Window::toggleFullscreen() {
SDL_WM_ToggleFullScreen(SDL_GetVideoSurface());
}
void Window::handleMouseDown(SDL_Event event) {
static const Uint32 DOUBLECLICKTIME = 500;
static const int DOUBLECLICKDELTA = 5;
MouseButton button = getMouseButton(event.button.button);
Uint32 ticks = SDL_GetTicks();
int lastMouseX[100];
int lastMouseY[100];
int n = (int) button;
if(ticks - lastMouseDown[n] < DOUBLECLICKTIME
&& abs(lastMouseX[n] - event.button.x) < DOUBLECLICKDELTA
&& abs(lastMouseY[n] - event.button.y) < DOUBLECLICKDELTA) {
eventMouseDown(event.button.x, event.button.y, button);
eventMouseDoubleClick(event.button.x, event.button.y, button);
} else {
eventMouseDown(event.button.x, event.button.y, button);
}
lastMouseDown[n] = ticks;
lastMouseX[n] = event.button.x;
lastMouseY[n] = event.button.y;
}
MouseButton Window::getMouseButton(int sdlButton) {
switch(sdlButton) {
case SDL_BUTTON_LEFT:
return mbLeft;
case SDL_BUTTON_RIGHT:
return mbRight;
case SDL_BUTTON_MIDDLE:
return mbCenter;
default:
throw std::runtime_error("Mouse Button > 3 not handled.");
}
}
char Window::getKey(SDL_keysym keysym) {
switch(keysym.sym) {
case SDLK_PLUS:
case SDLK_KP_PLUS:
return vkAdd;
case SDLK_MINUS:
case SDLK_KP_MINUS:
return vkSubtract;
case SDLK_LALT:
case SDLK_RALT:
return vkAlt;
case SDLK_LCTRL:
case SDLK_RCTRL:
return vkControl;
case SDLK_LSHIFT:
case SDLK_RSHIFT:
return vkShift;
case SDLK_ESCAPE:
return vkEscape;
case SDLK_UP:
return vkUp;
case SDLK_LEFT:
return vkLeft;
case SDLK_RIGHT:
return vkRight;
case SDLK_DOWN:
return vkDown;
case SDLK_RETURN:
case SDLK_KP_ENTER:
return vkReturn;
case SDLK_BACKSPACE:
return vkBack;
case SDLK_0:
return '0';
case SDLK_1:
return '1';
case SDLK_2:
return '2';
case SDLK_3:
return '3';
case SDLK_4:
return '4';
case SDLK_5:
return '5';
case SDLK_6:
return '6';
case SDLK_7:
return '7';
case SDLK_8:
return '8';
case SDLK_9:
return '9';
case SDLK_a:
return 'A';
case SDLK_b:
return 'B';
case SDLK_c:
return 'C';
case SDLK_d:
return 'D';
case SDLK_e:
return 'E';
case SDLK_f:
return 'F';
case SDLK_g:
return 'G';
case SDLK_h:
return 'H';
case SDLK_i:
return 'I';
case SDLK_j:
return 'J';
case SDLK_k:
return 'K';
case SDLK_l:
return 'L';
case SDLK_m:
return 'M';
case SDLK_n:
return 'N';
case SDLK_o:
return 'O';
case SDLK_p:
return 'P';
case SDLK_q:
return 'Q';
case SDLK_r:
return 'R';
case SDLK_s:
return 'S';
case SDLK_t:
return 'T';
case SDLK_u:
return 'U';
case SDLK_v:
return 'V';
case SDLK_w:
return 'W';
case SDLK_x:
return 'X';
case SDLK_y:
return 'Y';
case SDLK_z:
return 'Z';
default:
Uint16 c = keysym.unicode;
if((c & 0xFF80) == 0) {
return toupper(c);
}
break;
}
return 0;
}
}}
window.h
#ifndef _SHARED_PLATFORM_WINDOW_H_
#define _SHARED_PLATFORM_WINDOW_H_
#include <map>
#include <string>
#include "types.h"
#include "platform_menu.h"
using std::map;
using std::string;
namespace Shared{ namespace Platform{
class Timer;
class PlatformContextGl;
enum MouseButton{
mbLeft,
mbRight,
mbCenter
};
enum SizeState{
ssMaximized,
ssMinimized,
ssRestored
};
const int vkAdd= VK_ADD;
const int vkSubtract= VK_SUBTRACT;
const int vkAlt= VK_MENU;
const int vkControl= VK_CONTROL;
const int vkShift= VK_SHIFT;
const int vkEscape= VK_ESCAPE;
const int vkUp= VK_UP;
const int vkLeft= VK_LEFT;
const int vkRight= VK_RIGHT;
const int vkDown= VK_DOWN;
const int vkReturn= VK_RETURN;
const int vkBack= VK_BACK;
const int vkDelete= VK_DELETE;
const int vkF1= VK_F1;
struct MouseState{
bool leftMouse;
bool rightMouse;
bool centerMouse;
};
enum WindowStyle{
wsFullscreen,
wsWindowedFixed,
wsWindowedResizeable
};
class Window{
private:
typedef map<WindowHandle, Window*> WindowMap;
private:
static const DWORD fullscreenStyle;
static const DWORD windowedFixedStyle;
static const DWORD windowedResizeableStyle;
static int nextClassName;
static WindowMap createdWindows;
protected:
WindowHandle handle;
WindowStyle windowStyle;
string text;
int x;
int y;
int w;
int h;
string className;
DWORD style;
DWORD exStyle;
bool ownDc;
public:
static bool handleEvent();
Window();
virtual ~Window();
WindowHandle getHandle() {return handle;}
string getText();
int getX() {return x;}
int getY() {return y;}
int getW() {return w;}
int getH() {return h;}
int getClientW();
int getClientH();
float getAspect();
void setText(string text);
void setStyle(WindowStyle windowStyle);
void setSize(int w, int h);
void setPos(int x, int y);
void setEnabled(bool enabled);
void setVisible(bool visible);
void create();
void minimize();
void maximize();
void restore();
void showPopupMenu(Menu *menu, int x, int y);
void destroy();
protected:
virtual void eventCreate(){}
virtual void eventMouseDown(int x, int y, MouseButton mouseButton){}
virtual void eventMouseUp(int x, int y, MouseButton mouseButton){}
virtual void eventMouseMove(int x, int y, const MouseState *mouseState){}
virtual void eventMouseDoubleClick(int x, int y, MouseButton mouseButton){}
virtual void eventKeyDown(char key){}
virtual void eventKeyUp(char key){}
virtual void eventKeyPress(char c){};
virtual void eventResize(){};
virtual void eventPaint(){}
virtual void eventActivate(bool activated){};
virtual void eventResize(SizeState sizeState){};
virtual void eventMenu(int menuId){}
virtual void eventClose(){};
virtual void eventDestroy(){};
private:
static LRESULT CALLBACK eventRouter(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static int getNextClassName();
void registerWindow(WNDPROC wndProc= NULL);
void createWindow(LPVOID creationData= NULL);
};
}}
#endif
|
|
|
|
|
I didn't see problems in your code. Is it the only error message you get? Did you try (as suggested) to change the header filename? Could you try too change slightly the function name?
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]
|
|
|
|
|
Just the relevant code would have sufficed.
"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 i have created a project which succesfully build in Release Unicode but give the error in subject line when tried to build in Debug - Unicode.
Please provode comment on this
|
|
|
|
|
Check your project properties in the Release and the debug mode for how they differ.
By the way what is the error that you receive?
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
pandit84 wrote: Please provode comment on this
The Debug and Release settings do not match.
"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
|
|
|
|
|
i need a sample which establish connection between service and our product.
i need named pipe connection in between service and any sample project .
i need one sample of named pipes
|
|
|
|
|
Is using google that difficult?
Here is the process:
Step 1: Open internet explorer
Step 2: type http://www.google.com. Hit Enter and the page for google opens
Step 3: Enter "sample named pipes C++" text in the search window
Step 4: Click "Search"
and lo and behold you have umpteen links where you can find something relevant to your query
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
AshNis wrote: i need a sample which establish connection between service and our product.
Hardly we could help you on this, we have no clue about 'your product', is it, for instance, a new fancy mp3 reader?
AshNis wrote: i need named pipe connection in between service and any sample project .
A few clouds went apart, there are many still, though.
AshNis wrote: i need one sample of named pipes
Ah, OK, this is reasonable, eventually. What about documentation [^]?
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 need the bumpers on my truck fixed.
"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
|
|
|
|
|
DavidCrow wrote: I need the bumpers on my truck fixed.
Dear Sir,
We would like to introduce ourselves as DODGY AUTOMOTIVE WORKS. We deal with all kinds of bumpers and other automotive repair works. You can reach us at 36349 (DODGY). We are awaiting to do business with you.
Warm regards,
DODGY automotive.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Been reading too much lounge.
I read that as:
Worm regards...
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Hi all,
I am getting a Microsoft Visual studio C Runtime Library error and that error is showing its cursor in dbghook.c file.
My problem is, when i debug my program it doesn't give any error and when i run it directly its giving an error.
How can i remove this error.
Thanks in advance
|
|
|
|
|
What error?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Microsoft Visual studio C Runtime Library error
|
|
|
|