|
The :1 indicates the view number of of the document is open in the current session (MDI-related).
For more details, look at the MFC source code file WINFRM.CPP, function
void CFrameWnd::UpdateFrameTitleForDocument(LPCTSTR lpszDocName)
<marquee scrollamount="3" scrolldelay="80" direction="right" width="40%" style="border: 2px inset silver;background-color:yellow;color:green;font-family:Verdana,Arial;font-size:8pt;font-style:italic">onwards and upwards...
|
|
|
|
|
I knew I'd seen the :1 before but since I've probably only written 3 MDI apps since they were introduced, I couldn't pull it from memory. Even so, I've not ever needed to open two of the same window! Most of what I do revolves around dialog boxes, and SDI apps, or no UI at all.
|
|
|
|
|
Hi !
I have a Handle on a process for which I'd like to change the priority. For this, I use the SetPriorityClass, but it fails, and it seems (with a GetLastError) that my aplication doesn't have the rights to change the priority of the process. (I'm running it on WinNT)
Anyone knows how I could change the priority ?
Thank s for your help!
Jérôme
|
|
|
|
|
You need to use AdjustTokenPrivileges() to enable the PROCESS_SET_INFORMATION access right. There are a few examples of how to do this in the docs.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
hey,
We want to synchronize a memory area with a file on disk.
I did the following steps:
- CreateFile(...,CREATE_ALWAYS)
- CreateFileMapping(FileHandle)
- pdata* <= MapViewOfFile(MapHandle)
then I use memcpy to write data to the file.
When I write a buffer to pData that is larger then the filesize, the buffer is truncated to the file size.
So I want the file to grow dynamically in size.
There is an api func DeviceIoControl with param FSCTL_SET_SPARSE to accomplish this, but this only seems to work on win 2000 with NTFS 5.
Anyone has an idea to accomplish this behaviour?
Thanks in advance.
|
|
|
|
|
Hi ,
I am trying to read some data from a tab delimited text file taking individual field values from text file and putting it into an access databse.I have 2 recordsets one that fetches data from Text file and the other is that inserts the values into the data base.The code after opening the recordset successfully is something like this.
if(rs.IsBOF())
return false;
rs.MoveFirst();//rs IS THE RECORDSET THAT FETCHES RECORDS FROM DATA FILES
while(!rs.IsEOF())
{
recset.AddNew();///recset IS THE RECORDSET THAT FETCHES RECORDS FROM DATAFILES
recset.m_A = rs.m_A;
recset.m_R = rs.m_R;
recset.m_Absolute = rs.m_Absolute;
recset.m_Relative = rs.m_Relative;
recset.m_Class = rs.m_Class;
// recset.m_Azimuth = rs.m_Azimuth;
// recset.m_Int = rs.m_Int;
//recset.m_Box =rs.m_Box;
recset.m_2002D = rs.m_2002D;
recset.m_2002H = rs.m_2002H;
recset.m_1993D = rs.m_1993D;
recset.m_1993H = rs.m_1993H;
recset.m_Growth = rs.m_TXT_Growth;
recset.m_Growth2 = rs.m_TXT_Growth2;
recset.m_Growth3 = rs.m_TXT_Growth3;
recset.m_Wt = rs.m_Wt;
//recset.m_Comment = recset.m_Comment;
if(!recset.Update( )){
AfxMessageBox("Record not added.");
return FALSE;
}
rs.MoveNext();
}
My problem is that some members like m_azimuth(type-CTime) and m_Int,m_Box(type-CString) are not being copied to access recordset and not being updated to Access and Update function is unsuccessful.all other members are numbers and they don't have any problem copying.One CString object m_class is being copied without any problem.
The commented code shown above is working well ,but if i uncomment these portions Update function fails,Can nebody tell me what may be the problem?
|
|
|
|
|
I don't use CRecordset class but I use ADO recordset and I had the exact same problem that you are describing. My problem was that the fields that I was updating were set to null, so I had to go and change their status flag manually to "Field OK".
The problem was that every new row that you add to your database has to have values that are initialized to some acceptable value. For strings for example it would be a good idea to initialize them to a space " ". Let's say that you have a table with three fields:
fieldInt | fieldDbl | fieldStr |
When you want to add a new row to this table you should initialize these fields first.
recordset.fieldInt = 0;
recordset.fieldDbl = 0;
recordset.fieldStr = " ";
// Then do some stuff like changing the values of these fields with the data that you get from the file.
recordset.AddNew();
I hope you understood this confusing description. And by the way, I looked at CRecordset class and probably you should call the function IsFieldNull() to check the fields.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
I have found that the MFC database classes SUCK. You may be better off doing one of the following:
1) If the name of your text file doesn't change, create a Linked Table in access to your text file. Then, you can use access insert/select statements to copy the data.
-or-
2) build your own insert statement from the retrieved data and execute it against access, rather than using all of the overhead crap of CRecordSet.
<marquee scrollamount="3" scrolldelay="80" direction="right" width="40%" style="border: 2px inset silver;background-color:yellow;color:green;font-family:Verdana,Arial;font-size:8pt;font-style:italic">onwards and upwards...
|
|
|
|
|
This huge workspace was originally developed in VC++ 6, now in 7 with some c# code in it. 46 projects in all. Huge thing. Bloated, badly architectured. I need to count the lines of code there are. Would like also to know other statistics (% of lines which are comments, whitespace, etc). Is there any free add-in or tool I could use? New to the whole .net thing, catching up with some books right now.
Thanks!
Juan Miguel
|
|
|
|
|
Look at www.wndtabs.com for the line counter
|
|
|
|
|
Thanks, that worked quite well.
Solution has over 1200 files, 262000, which 171000 are code, 51000 comments and 4000 mixed. Does that count as large?
(forgot to mention, 440 stored procedures and 140 tables in sql server)...
|
|
|
|
|
Hi,
I need to create a function which would take in parameters like printf (or scanf, fprintf etc). i.e
Say my function name is foo
I need to be able to call it with
foo(char *StringFormat, .....)
just like printf
can anyone help?
Thanks,
P
|
|
|
|
|
Look at the va_start() , va_arg() , and va_end() functions
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Thanks a lot
|
|
|
|
|
If I print my chart with the Axis Labels, then i have a problem with the font escapement.
For printing I use the Mapping Mode "MM_TWIPS" (Positive x is to the right; positive y is up.) and create the Font with escapement value=2700 (270 degree). In Print Preview the orientation of the label is correct (from up to down), but if I print the chart, on the paper the label differs (rotate 180 degree -> from down to up). So I dedect if the device context is for the print preview or for printing and change the orientation.So I was happy. Now I use the programm in Windows NT and the orientation is not correct. In Windows NT there is no difference between print an print preview and i don't make a difference between Print an Print Preview. Have anyone an idea?
Thanks and sorry about the English.
|
|
|
|
|
Are you setting up the DC for printing in the OnPreparDC() virtual function override in your view for printing?
This is the place to change the map mode to MM_TWIPS. Beyond that I am not too sure, as I normally only ever use MM_TEXT mode when printing.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Thanks,but I set the Map Mode in OnPrepareDC(), but this change nothing. So it wasn't the reason.
|
|
|
|
|
Hi
I have a dialog where there are some CStatic, CButton, CListCtrl controls on.
Now i want to be able to get all control names & types on the dialog so i could get the title that is on the controls. (label & button: caption, listviewcontrol: column name(s))
How could i do this?
Greetings
JensB
|
|
|
|
|
GetDlgItem. Use the name you have given the control as the parameter (something like IDC_LISTCTRL). It will return a CWnd*. Just cast it to the control of your liking. This way you can retrieve the caption (i think its GetWindowText) from the control.
|
|
|
|
|
yes, that works when you know the name of the control.
I apologise if the question wasn't clear. (blame it on my english, not me )
But suppose, i want to use the code for every dialog.
So i need to know the names of the controls dynamicaly.
And get all captions (GetWindowText()) of all static controls.
Greetings
Jens
|
|
|
|
|
Create a member variable for each of your control, so if you have several dialogs, you can still reach each control. For exemple, with a CEdit :
CString bla;
CDialog m_DialogNumber1(ID_DIALOG1);
CDialog m_DialogNumber2(ID_DIALOG2);
m_DialogNumber1.Create(...);
m_DialogNumber2.Create(...);
m_DialogNumber1.m_EditCtrl.GetWindowText(bla);
m_DialogNumber2.m_EditCtrl.GetWindowText(bla);
This example sucks, but i think you'll get the idea.
~RaGE();
|
|
|
|
|
well, i needed to get the WindowText of some controls. You can assign a member variable to it.
But the idea was not to do anything special, but just getting some kind of collection of all resources in the form. Then i would get that collection, check the type of resource (button, ...)
Why do i want to achieve this:
The program runs in about 3 languages. For easy translation, i want to be able to get all 3 translations of the text that is on the button for example.
Of course, i can type it over .. but because i'm a bit lazy it's alot of work.
I thought it would be easier to programmicaly do this.
Greetings
Jens
|
|
|
|
|
Use EnumChildWindows() and then GetWindowLong( hWnd, GWL_STYLE ) and GetClassName( .. ) to work out what type a control is.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hello,
I need to implement a chart control (from custom control) that will display real time data (I receive a point every 13 msec), in a normal line mode (e.g. something like an oscilloscope).
But I'm really really new to "graphical programmation". I found some examples here and I based my work on them (using memory bitmap we draw in, then "push" it to the display). I draw just once the "background" of the object (axes, grid, ...) on a bitmap and when I need to plot a new point, I add it to the bitmap.
I was wondering if this method will support high speed ?? If not, what can I do for it ?? A better solution is perhaps to invalidate just the region from the old point to the new point ??
Just a last thing to say: I program in embedded visual C++ (so for Pocket PC, ...) but I posted my question here cause the language is almost the same (some functions are not in embedded) and there's much more people oon this forum ! So, that's also a reasoon why I want to do it myself: I didn't found any chart that fits my needs!
All suggestions are welcome (as I said before, I'm newbie in this domain).
Thanks
|
|
|
|
|
For my application i used the CGraph Class from Brian Converey (http://home.attbi.com/~bconvery3/dev/cgraph4.html). But I must modified it for draw real time data. I can send you my changed code. Send me an email.
|
|
|
|