|
And there is always the WideCharToMultiByte and MultiByteToWideChar FUNCTIONS you can call... Avoiding the whole ATL issue altogether...
|
|
|
|
|
Thanks you so much.
It's exactly what I want and it works!
Bob
|
|
|
|
|
OK, my problem for some of you may seem silly but I'm a rookie at Windows API.
I've written a program - a simple database (it stores student's names and their marks). All of this information is contained in Edit controls. It all works fine but when I add more students to the list some of them aren't shown. So I have to make a vertical scrollbar. But I don't have any idea how to do it. I've found some description about SCROLLINFO structure but I don't know how to use it. I've added WM_VSCROLL to my window class, but it just shows up and do nothing. I would be very grateful if someone could help me.
I'm using Dev C++ if it matters.
And some info about this program - the number of students is indicated by a global variable int a. It is increased by a function void new_student(). Each control is 30 high + 10 of space. At the top of that list there are static controls which name the columns - they're the same size as Edits...
And sorry for my English
Edit: If you know some easier way to do the scrolling (by hitting some keys or something like that) please write it too
|
|
|
|
|
Hi, I want to simulate a keypress using SendInput(). I am trying to send the letter 'a' to the programme VLC(VideoLAN) to adjust the volume.
Can anyone please show me a full example of something like this, using either SendInput(), SendMessage or any other way? I am using Visual C++. I have googled for this for three days now, and I can't find any good examples
Thanks in advance!
pete
|
|
|
|
|
|
How can I change the content of the status bar of the main frame in view.cpp ?
Thanks!
|
|
|
|
|
Last I read it was very difficult to alter the text in pane 0. This is because the MFC framework is always writing something to it, so even if you wrote something else to it, it would only last a fraction of a second until MFC changed it. Depending on what you are doing, it might be better to create a second pane and write to it.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
With the following steps:
1.Define a value,such as ID_FO_INDEX_MOUSEPOS.
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_FO_INDEX_MOUSEPOS,
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
2.Add a update message to your view.
afx_msg void OnUpdateMousePos(CCmdUI *pCmdUI);
ON_UPDATE_COMMAND_UI(ID_FO_INDEX_MOUSEPOS, OnUpdateMousePos)
3.Change it with the following style:
void CFOPCanvasCore::OnUpdateMousePos(CCmdUI *pCmdUI)
{
pCmdUI->SetText(m_IndMousePosString);
}
Jack
---------------------------------------------------------------------------------
XD++ MFC/C++ Flow/Diagram Library -- http://www.ucancode.net
|
|
|
|
|
You'll also need a stringtable entry for ID_FO_INDEX_MOUSEPOS in the project's .rc file.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Is there a way to open up a word document as read-only when it's not a read-only file to begin with. I opened up my file using CreateProcess. Is there a way to do this? Thanks!
|
|
|
|
|
CreateProcess() does not open files !!!!!!!
if you want to open a file with the ReadOnly option, you could do this :
std::ifstream file("theFile.txt");
or
fopen("theFile.txt", "r");
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I tried the following and still won't open up. I want to open it up in MS Word which was why I used CreateProcess. What did I do wrong? Thanks!
FILE * pFile;
pFile = fopen (filename,"r");
if (pFile!=NULL)
{
fputs ("fopen example",pFile);
fclose (pFile);
}
|
|
|
|
|
Is using ShellExecute() out of the question?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
No but how is it different from CreateProcess? There seems to be no parameters that specify it as read-only.
|
|
|
|
|
I see, you are trying to open with word and not with your own program for reading. What you want to do will probably need to use word OLE automation. I would suggest doing some searching for just that, it's not as simple as just executing the program to do this. It's actually not much more code but understanding the concepts is a bit more complex. I haven't done this sort of thing in a long time so I don't know the code off hand, but I'm sure a quick google search will find something.
-- Rocky Dean Pulley
|
|
|
|
|
I found a simpler way. Before opening up the document in Word, I used GetFileAttributes() to get its file attribute. If the returned value is not read-only, I called SetFileAttributes to set it so and then use CreateProcess to open it up within Word. Much simpler. Thanks for your help though.
|
|
|
|
|
Assuming that you meant CreateFile, pass the second parameter as GENERIC_READ.
-- Rocky Dean Pulley
|
|
|
|
|
CFile SrcFile;
CString SrcFileName="C:\\test.doc";
SrcFile.Open(SrcFileName,CFile::modeRead ,NULL);
|
|
|
|
|
I do not want to read the contents of the file. I want to be able to open the file in Microsoft Word or Notepad as read-only.
|
|
|
|
|
How can I declare a pointer pointing to the mainframe in view.cpp ?
(I want to use the mainframe object in view.cpp)
Thanks!
|
|
|
|
|
add a frame pointer member in your views,
so the MainFrame passes the this pointer (itself actually) to the child view that have now a pointer to its mainframe...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Anonymous wrote:
How can I declare a pointer pointing to the mainframe in view.cpp ?
In the view's .h file, just add a member variable of whatever type your frame is (e.g., CMainFrame ). To define and use that member variable, try AfxGetMainWnd() or GetParentFrame() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
what does this mean?
struct abc {
int (*loop)();
}
int Off()
{
return 1;
}
abc->&Off;
i don't understand this sourcecode!
Thx for explaination!
|
|
|
|
|
abc is a structure that holds a pointer to a function which takes no arguments and returns an int. it's also missing a semicolon at the end.
i'm not sure what that last line is.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
<font color=blue>int</font> (*loop)(); this defines a pointer to function.
it means that abc structure is looking for its loop member any function that has the same signature (no parameters, and an int as returning value).
abc->&Off; this is not correct for me, as abc is a type (and so, not an instance of that struct) and loop is not static so we cannot directly apply to it the operator -> .
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|