|
Are you linking with psapi.lib?
Add the following statement to your cpp file.
#pragma comment(lib,"psapi.lib")
John
|
|
|
|
|
Hi John,
Thank you very much . It worked.
Anil
|
|
|
|
|
you need to link with psapi.lib. add it in the link settings.
|
|
|
|
|
Hi,
I have a basic HTML Browser built using the MFC Wizard. I am having a page where I have a set of images. On clicking the images, I am changing the title through Javascript.
Now in my HTMLViewerView.cpp, I override OnTitleChange to actually open up in full view the image clicked on. However, even navigate doesnt seem to work in OnTitleChange. Here's my code snippet...
void CMFCSlideViewerView::OnTitleChange(LPCTSTR lpszText)
{
CHtmlView::OnTitleChange(lpszText);
AfxGetMainWnd()->SetWindowText(lpszText);
CString title;
AfxGetMainWnd()->GetWindowText(title);
Navigate(_T("http://www.microsoft.com"));
}
Please note, I actually want to navigate to whatever is set in my title. However, even calling a standard URL doesnt work. I dont get any errors, my navigate call just doesnt navigate. Suggestions welcome.
Thanks in advance,
Vish
|
|
|
|
|
I'm looking for documentation of, or a helper library for, BSC files. Does such exsist? I'd like to write a utility that extracts information from the BSC and dumps it to an SQL database, and ultimately create something like LXR for applications built with developer studio.
|
|
|
|
|
Can't say I know of any documentation for BSC files. One problem with this approach is that you can't get any output until you have an app the will compile. In ED (see sig) I've written my own source parsers which build a database in background threads, so you have code navigation, lookup and browsing from the get go.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Yep, there are a number of products that re-parse the source code that way. The issue there is given the idiosyncracies of the MS compiler you can't ensure that your parser resolves references the same way MS's does. IOW, I want my info from the same compiler that builds the bits I give to my customers.
ED's a nice tool by the way, just not the right thing for me in this case.
|
|
|
|
|
How can I tell wether a button control is being held down or not? I can't seem to use the flag from WM_LBUTTONDOWN because I don't have the same flag parameter passed into my button handler
Any ideas?
Andy
|
|
|
|
|
It's being held down until you get a WM_LBUTTONUP message.
|
|
|
|
|
hmm tried what you said, what I really want is this, and I couldn't get it to work. I want to execute one bit of code when the button is pressed and then another when it is released. How can I do that?
Andy
|
|
|
|
|
Just a suggestion: you can perhaps subclass your own button class (derived from CButton) and add handlers for the WM_LBUTTONDOWN and the WM_LBUTTONUP messages. In these functions, send a notification message to the parent.
Hope this helps
|
|
|
|
|
is there any way to detect that a particular button is being held down. i.e. on the WM_LBUTTONDOWN message, how can I check wether a particular button is pressed in a similar way to say a checkbox?
Andy
ps what notification message do you mean?
|
|
|
|
|
Another suggsetion is to add handlers for the WM_LBUTTONDOWN and WM_LBUTTONUP messages in your dialog (or view) class. In these functions, test if the position (the point parameter) is on the button.
For this you can use CWnd::ChildWindowFromPoint (take a look at the documentation) and then call GetDlgCtrlID for the CWnd that is returned to see if this is your button.
You can also use flags to keep trace if the button is pressed or not.
Hope this helps
|
|
|
|
|
I have a CRecordset class, which I'm using to update an Access table. I am using MoveFirst() to set the pointer to record 1 and am iterating through the table with MoveNext(). Everytime before moving to the next record, I update a text field. After about the third record, I get a 'Multiple rows were updated' message. If I click 'ok' and keep going with my update program, eventually I come to the EOF. It takes about 1-2 minutes to reach the EOF of a 20 record table on a Pentium 4. What could be the cause the above message? Thx,
Ralf.
ralf.riedel@usm.edu
|
|
|
|
|
Sounds like a unique identity problem. Does your table have a primary key and if so, are you using it when you do an update? If you are updating with a where clause that uses non-unique fields, then you very well may be updating multiple records. Say for instance you have a table with four columns--ID, NAME, COUNTRY, STATE
If you have two records that look like this:
ID NAME COUNTRY STATE
1 Bob USA CO
2 Bob USA VA
and you are doing an update like this:
UPDATE MYTABLE SET STATE="OK" WHERE NAME="Bob" AND COUNTRY="USA"
then you are going to have multiple updates with a single statement. What you should be doing is this:
UPDATE MYTABLE SET STATE="OK" WHERE ID=1
Just make sure that your where clause of your update is using a unique (record) identifier. Does that make sense?
Let me know if I'm off.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Your rationale makes perfect sense, but I don't think it is the problem. I do not have any primary key set up yet.
What I'm doing is this: I have a blank field that I want to populate with data from several other fields to generate a table with less fields. So, I traverse the entire table and do the updates. I have done this without a problem on two other tables.
I know that my explanation is not much further help, but maybe you have some more ideas. Thank you for your help,
Ralf.
|
|
|
|
|
What kind of flags are you using to open the recordset?
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Well, I am using the open() member function upon construction. I do not pass it any arguments. Here's another hint: As I said above, I was able to do updates on two other tables without any problems. It just zipped through the tables (>40,000 records) in less than 30 secs. The third table I have (0.6 million records) was first opened as snapshot. When I changed it to dynaset, it ran (actually still running since yesterday) without the 'Multiple records updated' error message. The problem now is speed. It's been running for almost 20 hours and still on record ~50,000. BTW, when testing, I deleted records from the third, big table (was left with only 20) and the problem with speed persisted. So, I don't think it's a size issue. Does this help? Thank you,
Ralf.
|
|
|
|
|
Well, according to microsoft you should not iterate through each element by calling MoveNext() because with large tables it drains the resources. I never ran into this problem because my databases don't have 0.6 million records, but one of the suggestions that I have heard is to use multiple record fetching, or use embedded SQL procedures.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Hi Everybody,
I have written a simple dialog based application that displays the image stored in a BMP file. The program works well for all images with uncompressed RGB images having bit depth 24 bpp and horizontal and vertical resolution as some positive value. However, with the files where horizontal and vertical resolution in BITMAPINFOHEADER is 0, the image is not displayed.
In my code, I am doing the following ---
1. Creating a DIB section using CreateDIBSection
2. Creating memory DC from DC of dialog window using CreateCompatibleDC
3. Associating the DIB section with memory DC using SelectObject
4. Copying DIB data into the buffer created by CreateDIBSection
5. Rendering the data using BitBlt/ StretchBlt
What else am I missing?
Any pointers on the same shall be highly appreciated
Regards
|
|
|
|
|
I may be missing something but an image with 0 rows and 0 colums has 0 pixels to display....
John
|
|
|
|
|
John M. Drescher wrote:
I may be missing something but an image with 0 rows and 0 colums has 0 pixels to display....
I think he's talking about the DPI resolution, not the width/height
[edit]I just read it again, and now I'm not so sure... [/edit]
Ryan "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"
|
|
|
|
|
Ryan Binns wrote:
I just read it again, and now I'm not so sure...
I felt that way when read the question. A coworker thought that he had an corrupt bitmap and wanted to know how to display it in that case..
John
|
|
|
|
|
John M. Drescher wrote:
I felt that way when read the question. A coworker thought that he had an corrupt bitmap and wanted to know how to display it in that case..
Sorry for the confusion I had created. Here are the values of interest from BITMAPINFOHEADER
biWidth = 256
biHeight = 256
biXPelsPerMeter = 0
biYPelsPerMeter = 0
I think that the last two values are the cause of the problem. For images in which these values are non zero, they are displayed properly.
Just wondering how Windows Paint is able to display the file with which I am facing the problem!!
Can somebody now say what is happening
Regards
Satyaki
|
|
|
|
|