|
To use 32bit scroll values you need to use GetScrollInfo() and SetScrollInfo().
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Thanks a lot.
Just for those also interested it,
I get it done like this:
This method of extracting 32-bit scroll box positions works only in those scroll messages that are sent to a window when the user grabs the thumb and drags it. It is not possible to obtain 32-bit scroll box position in cases of programmatically sent SB_THUMBTRACK and SB_THUMBPOSITION scroll messages. First, the 32-bit information cannot be packed into the WPARAM of the messages because only the High Word contains the scroll position. Second, the nTrackPos member of the SCROLLINFO structure maintained for scroll bars cannot be set programmatically. Any calls to SetScrollInfo to set the immediate scroll positions are ignored by the operating system.
Sample Code
void CMyWnd::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
if(nSBCode == SB_THUMBTRACK || nSBCode == SB_THUMBPOSITION)
{
// First determine if the user scrolled a scroll bar control
// on the window or scrolled the window itself
HWND hWndScroll;
if ( pScrollBar == NULL )
hWndScroll = m_hWnd;
else
hWndScroll = pScrollBar->m_hWnd;
SCROLLINFO info;
info.cbSize = sizeof(SCROLLINFO);
info.fMask = SIF_TRACKPOS;
::GetScrollInfo(hWndScroll, SB_HORZ, &info);
nPos = info.nTrackPos;
}
//......
//......
}
I found this from here:
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q152/2/52.asp&NoWebContent=1
|
|
|
|
|
Hi..
Just wondering if there is a installation software like installshield which can automatically install an device driver(with inf file).
i have written a program which calls an SetupCopyOEMInf function from DDK. It works fine with win2000 and winxp but not with win98 and me..
thanks...
|
|
|
|
|
do u really think this is your most important thing??
if your driver is not a WDM one, then you will have to write a second version only for 98/me.
|
|
|
|
|
Hi All,
Attached is a simple c++ code that is to be, after compilation, called from MATLAB. When the line "afxbeginthread" is removed every thing is ok. When the line is re-placed the code compile but does not execute. Any suggestions?
Regards
Sam, Melbourne
#include "c:\temp\stdafx.h"
#include "c:\temp\mex.h"
/********************************************************************/
UINT THREADD1(LPVOID pParam)
{
printf(" %10.1f\n", 5.5);
return 0;
}
/*********************************************************************/void init_rt_pars ( void )
{
printf(" %10.1f\n", 3.3);
}
/*********************************************************************//* The GateWay Routine */
/* /********************************************************************/
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray*prhs[] )
{
/*************************************************************/ init_rt_pars();
AfxBeginThread(THREADD1,NULL);
init_rt_pars();
/*************************************************************/
return;
}
|
|
|
|
|
Try CreateThread and _beginThread!
A. Riazi
|
|
|
|
|
Hi A. Riazi,
Many thanks for your reponse.
I have tried CreateThread with no success.
I have also eliminated MATLAB now (ie the function that initiates the thread is main() not mexFunction) and the problem is still there. Any further suggestions?
Regards,
Sam
|
|
|
|
|
Try replacing:
<br />
AfxBeginThread(THREADD1,NULL);<br />
with:
<br />
AfxBeginThread(THREADD1,NULL,0,0,0,NULL);<br />
|
|
|
|
|
Why would this:
fwrite(dataPtr,sizeof(unsigned char),(sizeof(unsigned char)*datalength),filePtr);
ALWAYS return 0 byte written
I can open the file ok using
filePtr = fopen (DataFile,"wb");
but whenever I try to write the data down it fails.
Anyideas?
Thanks!
|
|
|
|
|
are you sure your dataPtr is not NULL ?
(or 0 - whichever your prefer )
|
|
|
|
|
lol
I just checked that and it seems my data pointer is not pointing to the right place. LOL. fix that and then try again.
Thanks. I might be back.
|
|
|
|
|
ok pointers are all correct now, data is where I need it to be. But still, no data being written when calling the fwrite.
|
|
|
|
|
Did the file open succeed? If you look at the data buffer in the debugger is it what you expect? What does errno tell you? Why aren't you checking what fopen() and fwrite() return.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Firstly, your code should be like this:
fwrite(dataPtr, sizeof(unsigned char), datalength, filePtr);
It does not make any difference in case of a char, but if you use integers for example, your code will try to write 4x4xdatalength = 16xdatalength bytes of data, instead of writing 4xdatalength bytes.
Anyway, apart from that be sure to check the datalength. Check out whether it is 0 or not.
If it still does not work, add the following line after writing to the file:
fflush (filePtr);
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
<nobr>They say I'm lazy but it takes all my time
|
|
|
|
|
Ok,
I did finally find it. Turned out that my global datasize number was being clobbered all the time, aka ending in a data size of 0 to be written.
Thanks for all of your help! I REALLY appreciate it!
Woo HOO!!
Dan
|
|
|
|
|
Dear Forum,
Ok, this is really starting to bug me. Anybody have any idea why the 'TableName' is not being added to the string 'str', even though the 'TableName' seems to be valid as the watch window shows the correct value and the TRACE call does manage to successfully out put it?
for (std::vector<DFields *>::iterator it = pConfig->Samples.begin(); it != pConfig->Samples.end(); ++it)
{
CString str = _T("");
if (pConfig->IncludeComputer)
{
str += (*it)->ComputerName;
str += _T(" : ");
}
if (pConfig->IncludeTable)
{
TRACE("*%s*\n", (*it)->TableName);
str += (*it)->TableName;
str += _T(" : ");
}
str += (*it)->SampleName;
m_ListSelected.AddString(str);
}
After this function, 'str' is (sans quotes): "Barn 1 Feed : : Total Daily Feed"
and the TRACE output is: "*743 Daily*".
str should be: "Barn 1 Feed : 743 Daily : Total Daily Feed"
I have tried to do a rebuild all, exit dev studio and then rebuild all, even rebooted my computer. But still no luck. All I know is that I will probably see what I am doing wrong as soon as I hit the submit button
[edit]
ComputerName, Tablename, and SampleName are all CStrings.
[/edit]
Signed
Confused in abby
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I don't have a clue,
but have you tried casting the TableName to f.e. (char *) or something alike..?
I wouldn't be amazed if it was some sort of type-confusion..
|
|
|
|
|
hmmm. That worked. wierd
Thanks a lot .
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Its because your mixing crappy old MFC CString and lovely new STL, you naughty boy you.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hello i was told to look here for something that would convert a VC++ 7.10 Project to a VC++ 7.0 project can anyone help me ???
|
|
|
|
|
|
Hi,
I'll try to explain my problem in as few words as possible so I won't scare anyone off with long posts
Mission :
I'm working on a hobby-project to render graphics that change with user-input.
Problem :
GfxObjects can be deleted/changed, but *during* rendering that's a big NONO as you'll probably understand
Possible solutions :
- Multithreading.
Tried it, it's a very big pain in the arse.
GfxObjects could be plugins with their own imported edit-dialogs and I don't want other developers to have the burden of doing locking / unlocking everywhere (and give'em a perfect opportunity to crash my app).
- Singlethreaded :
OnIdle is fine, it's just not enough.
F.e. when the mouse enters the menu, idling stops.
Same for window-resizing etc.
The ideal way would be :
{
ProcessUserInput( [for a maximum time of 1/100th sec.] );
RenderFrame();
}
I hope some of you guys have suggestions on how to tackle this
-
Lennart Denninger / GameCoder / Guerilla Games
|
|
|
|
|
Well like it or not I think you need to use the multithreading approach to get the result you want. One interuptable thread for rendering, and UI back in the main app thread.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I know...
But it would be nice to have a way to lock the object-system before all the ui-handling and unlock it afterwards.
Just like locking it before rendering and unlocking it after rendering.
Locking / unlocking for every single change sucks,
it means that for someone to write a plugin with an edit-dialog the code would look like this :
CEditDlg::OnVar1Changed()
{
LockObjectSystem();
// change var here
mObject->SetVar("General.SplineSegments", 10);
UnlockObjectSystem();
}
I'd prefer something like
{
LockObjectSystem();
UpdateALLDialogsAndSettings();
UnlockObjectSystem();
}
'cause in this case the people creating plugins wouldn't need to know about all the locking-stuff, and more important - they wouldn't be able to send my app down in flames by simply forgetting to lock/unlock.
|
|
|
|
|
Why can't you collect the info they enter in the plugin and then apply it when the plugin finishes. This puts you in total control and you can handle any locking required.
Can't say I comprehend precisely what you are getting at with locking, but I assume you only want one user/thread/plugin to be able to change objects at a time.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|