|
Is there a way to catch those key strokes before Windows processes them?
|
|
|
|
|
Yes, by using SetWindowsHookEx() withWH_KEYBOARD or WH_KEYBOARD_LL, as Perspx said.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Can anyone help me, or at least point me to some good sites that will help with reading and writing binary files on the fly without using an array?
|
|
|
|
|
Binary files and arrays have nothing to do with the other.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Ok then, well that only answered part of my question. How do i read and write a binary file, what are some keywords i should be looking up?
|
|
|
|
|
you can use fopen, fread, fwrite, and finally fclose. google for those functions.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
That all depends on what you are using to open/create the file. Some possibilities include:
fopen()
CreateFile()
CFile
ofstream Each of these has their own way of opening/creating a binary file.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
With fopen, fread and fwrite.
Here's a rough n nasty example:
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *fp;
long i;
long fLen;
long tmpValue;
fp = fopen("test.dat", "r+b");
if (fp == NULL)
{
printf("File doesn't exist\n");
printf("creating...\n");
fp = fopen("test.dat", "w+b");
}
if (fp)
printf("File opened successfully.\n");
else
return -1;
for (i=0; i<100; i++)
fwrite(&i, sizeof(i), 1, fp);
fseek(fp, 0, SEEK_END);
fLen = ftell(fp);
fseek(fp, 0, SEEK_SET);
for (i=0; i<fLen/sizeof(long); i++)
{
fread(&tmpValue, sizeof(long), 1, fp);
printf("%4d", tmpValue);
}
fclose(fp);
return 0;
}
|
|
|
|
|
Thanks, this looks quite helpful, i will get to work on this
|
|
|
|
|
Hi All
I have a question about mouse right click.I want to do if mouse right click on MyComputer Drive(C:\,D:\,...) then Message Show of Drive Name.
User click on C:\ drive then message show C and if user click on D:\ drive then message show D.
Is it possibel?If yes then how can i do?
Plz help me
|
|
|
|
|
Do you need this implimentation in Explorer window?
-@SuDhIrKuMaR@-
|
|
|
|
|
can you give me API or example for this..
Plz help me
|
|
|
|
|
Seems you are trying to integrate "something" into explorer's context menu. Whatever it may be, you've to modify explorer's context menu.
1) One method is to write shell extension to implement IContextMenu . Refer this excellent article by Michael Dunn[^].
2) if you want to do it in very simple method without writing shell extension, then modify registry to add a specific menu item to shell which will execute your specified executable on clicking. Check the "Explorer Context Menu" section in this link[^].
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi everybody, iam trying to prevent the user from resizing, maximizing and minimizing a FormView window by using : OnSize and OnSizing functions, but it did not work? can somebody help? Thansk in advance
|
|
|
|
|
U r using Mdi Application ?
Than Override OnSize in CChildFrm and you will get the functionality.
|
|
|
|
|
susanne1 wrote: Hi everybody, iam trying to prevent the user from resizing, maximizing and minimizing a FormView window by using : OnSize and OnSizing functions, but it did not work? can somebody help? Thansk in advance
You can handle WM_GETMINMAXINFO or in MFC add a message map entry called
ON_WM_GETMINMAXINFO and function prototype looks like this ...
afx_msg void OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI );
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
For disabling window resizing you've to handle WM_GETMINMAXINFO message. Check this [^]for code snippet.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi Jijo, thanks for your reply, i used WM_GETMINMAXINFO message but it did not work(visual studio does
not come to it)
Any idea why?
Thanks
|
|
|
|
|
susanne1 wrote: Any idea why?
Without seeing your code, it's going to be hard to say for sure. Did you use ClassWizard to create the handler function for it, or did you try to implement the function manually?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Whether its MDI/SDI? And you're trying to restrict that of a child view?
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
susanne1 wrote: Subject:Visual C++6
susanne1 wrote: iam trying to prevent the user from resizing, maximizing and minimizing a FormView window
So your question is not about Visual C++ 6, is it ?
|
|
|
|
|
sure it is about VC++6 / MFC
|
|
|
|
|
are you on crack ?
when you ask a question, the topic has to be specific, and not talk about the TOOL you're compiling your code with !
|
|
|
|
|
Hi,
I am using ClistCtrl Control with two column one displays the URL and the other displays the time.
I want that the url should appear as a hyperlink rather than a normal text and on clicking it the specified url should open in a browser
The code is as follows:
void CGetFootDlg::GetFootPrintURL(int n,CString strResponseFootPrints,CString g_strDelimFLD)
{
if(n>-1)
{
if(strResponseFootPrints.IsEmpty())
return;
CStringArray* ptrstrArray = CParser::Parse(strResponseFootPrints,g_strDelimFLD);
int j=ptrstrArray->GetSize()-1;
TCHAR szName[] = _T("Sandra C. Anschwitz");
::IsWindow(m_lstGetFootPrints.m_hWnd);
for(int i=0; i<ptrstrarray->GetSize(); i++)
{
LV_ITEM lvItem;
ZeroMemory(&lvItem, sizeof(LVITEM));
lvItem.mask = LVIF_TEXT;
lvItem.iSubItem = 0;
lvItem.iItem = i;
lvItem.pszText = szName;
lvItem.iImage = 0;
int nItem=m_lstGetFootPrints.InsertItem(i,szName);
int start=0,end=0,len;
CString str,strFPurl,strFDuration;
str=ptrstrArray->GetAt(i);
strFPurl=strFDuration=str;
len=str.GetLength();
end=strFPurl.Find(' ',0);
strFPurl=strFPurl.Mid(0,end);
start=strFDuration.Find(':',end+1);
strFDuration=strFDuration.Mid(start+1,len-1);
m_lstGetFootPrints.SetItemText(nItem,0,strFPurl);
m_lstGetFootPrints.SetItemText(nItem,1,strFDuration);
}
}
}
Can anyone help me.
Thanks
Dhiraj Kumar Saini
|
|
|
|
|
Dhiraj kumar Saini wrote: Can anyone help me.
Google[^] does sometimes help!
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|