|
Rakesh_Thakur wrote:
How can I retrive the complete path of "My Documents" folder?
have a look at http://www.codeproject.com/shell/shellextguide6.asp
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
Hi all friends .
I develop a program that always read a data buffer from hardware very fast and display it on a dialog . It is not possible use of GDI's API for data displaying because it's very slow . I use DirectDraw but using of it is very hard and produce bugs ( example its draw in space of other windows and ...) . Now I search for an function , technology or ... that I give it a buffer of color data with it's elements position to draw it in correct position .
the buffer is similar this :
_______________________________________________________
| RGB(,,) | RGB(,,) | RGB(,,) | ... |
-------------------------------------------------------
and element's position of buffer is similar to :
_______________________________________________________
| (x1,y1) | (x2,y2) | (x3,y3) | ... |
-------------------------------------------------------
If you know please help me !
thanks a'lot
|
|
|
|
|
A_Fa wrote: It is not possible use of GDI's API for data displaying because it's very slow
Really? I find it capable of rendering screens of pixels faster than my human eye can perceive
them.
A_Fa wrote: I use DirectDraw but using of it is very hard and produce bugs
DirectDraw with a DirectX-enabled/capable video card is probably the best performance you'll
get. DirectDraw is "hard" - there is a learning curve, but it doesn't Produce bugs - It renders
YOUR bugs very quickly.
You must be working with REALLY FAST hardware
|
|
|
|
|
Or alternatively, very bad at writing efficient GDI code.
Very early on, I learned the benefits of Polyline over MoveTo/LineTo/LineTo/LineTo etc., and similar things. I do like your comment about DirectDraw!
Steve S
Developer for hire
|
|
|
|
|
Steve S wrote: Or alternatively, very bad at writing efficient GDI code.
Si!
|
|
|
|
|
Seriously, GDI is plenty fast for rendering your data. There's no need to refresh the screen
more than 30 times a second...24 is fine for perceptively smooth video.
I would suggest focusing on translating that incoming data into a renderable format as quickly
as possible. Don't draw a pixel at a time. Start with a DIB section so you have a pointer to
its RGB bits. Translate your incoming data and insert the RGB values right into the DIB section's
buffer. Blit the DIB to the dialog at regular intervals.
If the hardware is really that fast you may need to drop data to throttle the output. You are
displaying to a human user (I assume) so there's no need to have some ridiculous refresh rate.
I'm pretty sure any speed problems are going to be I/O-related, not rendering-related.
Mark
|
|
|
|
|
Hi fellows
I'm developing an app that needs to use function pointer. I'm assigning one of my methods in a function pointer variable.
this is my fuction pointer variable:
<br />
unsigned int (__stdcall * ObjectEvent)(void*);<br />
This variable needs to be like this because in the header file that I use there are a typedef with the same signature of my variable and some functions of this header that uses this typedef. See:
<br />
typedef unsigned int (__stdcall *HDSchedulerCallback)(void *pUserData); <br />
This is my method signature:
<br />
unsigned int __stadcall Object3DS::ObjectCallBack(void * vData)<br />
{<br />
MessageBox(NULL, "working", "Info", MB_OK);<br />
return 1;<br />
}<br />
This is my code when I put the method of my class into the function poiner variable:
<br />
void Object3DS::LoadObject3DS(const char * cObjectName, bool bVisible, float fX, float fY, float fZ)<br />
{<br />
...<br />
ObjectEvent = ObjectCallBack;<br />
m_ObjectHandle = hdScheduleAsynchronous(ObjectEvent, 0, HD_DEFAULT_SCHEDULER_PRIORITY);<br />
}<br />
HD_DEFAULT_SCHEDULER_PRIORITY is just a thread priority variable.
The error that I receive is this:
<br />
error C2440: '=' : cannot convert from 'unsigned int (__stdcall Object3DS::*)(void *)' to 'unsigned int (__stdcall *)(void *)'<br />
So fellows what I have to do to solve this?? I've tried somethings but nothing solved. I haven't any idea.
|
|
|
|
|
The problem comes from the fact that global functions and class functions don't have the same signature: for the class functions, the this (address of the instance of the class which call the function) is passed implicitely with the paramters.
If you want to solve the problem, specify your function as statis but then the problem will be that you won't be able to access non-static members (the function doesn't belong to any instance).
Again, you can solve this problem by using a global function as callback and pass the address of your instance (this pointer) to the hdScheduleAsynchronous function. Normally, every call back lets you do this. Then, inside your global callback function, cast the void pointer to a Object3DS* pointer and call a function from within your class.
An even nicer way to do it is not to use a global function but a static function from your class.
|
|
|
|
|
Tks for you all. I hope that works now.
|
|
|
|
|
You can do that only with a static method of the class. But if your method has to access instance members then you must find a way to pass them (perhaps the whole instance of the class) to it.
|
|
|
|
|
Tks for you all. I hope that works now.
|
|
|
|
|
Alex Cutovoi wrote: So fellows what I have to do to solve this??
See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Tks for you all. I hope that works now.
|
|
|
|
|
in a dialog have some buttons and a treeCtrl
i am overriding the function PreTranslateMessage to get the pressed key and do some processing depending on this key
the problem is :
whenever i press any key the default BEEP windows sound is played
why is that and how can i stop it
thnx 4 ur time and concern.
|
|
|
|
|
I think this is a feature of Windows OS -- beeping if a key cannot be processed by the focused control, like button.
Maybe you should return TRUE from your PreTranslateMessage for all of your keys, thus stopping further processing?
I hope this helps.
|
|
|
|
|
yea this help
now the problem solved
thnx alot 4 ur help
|
|
|
|
|
To eliminate the 'hang' you would be better off using threads. As for updating the display, without seeing your code I can only guess. But the WM_PAINT which would be responsible for displaying the data is Posted and processed when no other messages are in the que. I'm guessing that you are blocking your main message loop with your file reading, which would prevent you from seeing any updated data, regardless of whether you sent it to a control or not. Again, a thread would fix this problem, or process messages within your lengthy procedures.
|
|
|
|
|
i am able to show the popup menu
when user right clicks on tree view item
but now the problem is that when user clicks on some
Menuitem then the control doesn't reaches to the respective
menu handler in fact nothing is getting called
below is the code for showing the pop uo menu
void CTreeViewDlg::OnNMRclickTree1(NMHDR *pNMHDR, LRESULT *pResult)
{
CPoint ptMouse;
DWORD dwPos;
UINT nFlags;
CTreeCtrl *pTreeCtrl;
pTreeCtrl = (CTreeCtrl *)GetDlgItem(IDC_TREE1);
{
dwPos = ::GetMessagePos();
ptMouse.x = LOWORD (dwPos);
ptMouse.y = HIWORD (dwPos);
CPoint ptAction = ptMouse;
// convert coordinates
pTreeCtrl->ScreenToClient(&ptAction);
// determine if click is on tree item
HTREEITEM hItemRClick = pTreeCtrl->HitTest(ptAction, &nFlags);
// if click is on tree item,
if (hItemRClick != NULL)
{
// set selection to right+clicked item
pTreeCtrl->SelectItem(hItemRClick);
HMENU hMenu = LoadMenu(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MENU1));
if(hMenu)
{
hMenu = GetSubMenu(hMenu,1);
if(hMenu)
{
TrackPopupMenu(hMenu,0,ptMouse.x,ptMouse.y,0,pTreeCtrl->m_hWnd,NULL);
}
}
}
}
*pResult = 0;
}
Thanks and regards
harshal
|
|
|
|
|
hi again,
and did you add ON_COMMAND handlers for each menu command ?
-----------
Mila
|
|
|
|
|
I think instead of
TrackPopupMenu(..., pTreeCtrl->m_hWnd, ...);
you should try
TrackPopupMenu(..., m_hWnd, ...);
I hope this helps.
|
|
|
|
|
Hi.
I have developed an aplication that it read and write bytes through the serial ports. The program works fine, except for some PCs, (very few ones). While is reading the data, sometimes it ends the communication suddenly.
I found that it happend because ClearCommError fails, I have the following code:
<br />
<br />
...<br />
<br />
while( retry> 0 )<br />
{<br />
<br />
if( !ClearCommError( idCommDev, &dwError,&comstatInfo ))<br />
{<br />
lResult = 116;<br />
dwLasError = GetLastError();
return lResult;<br />
}<br />
<br />
if( !PurgeComm( idCommDev, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR ))<br />
{<br />
lResult = 115;<br />
return lResult;<br />
}<br />
lResult = TXPacket(dataTX, 250);<br />
<br />
if( lResult!= 0 )<br />
return lResult;<br />
<br />
lResult = RXPacket(dataRX, timeout);<br />
....<br />
<br />
This is my problem. In some PC, (I don't know why), the function ClearCommError() fail with no error code available with GetLastError(), so I can't figure out what is happened.
Thank you.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
hi everyone,
I downloaded a E Y Player from Code project from the following link
http://www.codeproject.com/useritems/Media_Player.asp[^].... when i try to play *.mpg, *.avi,*.vob,*.dat files its playing fine .... BUT WHEN I TRY TO PLAY m2p files its giving error in MCIWndCreate(...) method .....
SO CAN ANYONE TELL ME WHETHER MCI SUPPORTS M2P FILE FORMATS(*.m2p files)?????????????
Thank You,
With Regards
Raja Bose
|
|
|
|
|
Dear All,
I am working with MSXML.
I cant write integer values on XML files as a tag.
Why ?
I want to write integer vaules into XML File.
Kindly Help me.
Thanks.
|
|
|
|
|
Sakthiu wrote: I cant write integer values on XML files as a tag.
Why do you want to do that?
Can't you prefix with an alphabetic char the numbers?
|
|
|
|
|
Hi,
I am having a SafeArray of bytes .I should know the size of it.
Is there any way where we can get the size of safearray?
Thanks
Today is a gift, that's why it is called the present.
|
|
|
|