|
How to hide the web browser control in MFC application (Dialog based) ?
I tried :
SetVisible(0) but did not work
also tried ShowWindow() .. It hides the control but gives a debug assertion failure (m_hWnd=0) !!!
Can you help ?
|
|
|
|
|
|
Thank you but I already have :
m_web.Navigate(TEXT("www.microsoft.com"),NULL,NULL,NULL,NULL);
in OnInitDialog !!!
|
|
|
|
|
What the heck does exit code 136 (The system tried to delete the JOIN of a drive that is not joined.) mean?
I keep getting this in an app I've written in VC7. It also crashes on win98 (not XP) when you exit.
I've posted a link to the code and a request for testing here[^] if anyone is interested.
Thanks!
Jason Henderson "You must be the change you wish to see in the world." - Gandhi
articles profile
|
|
|
|
|
Just a short question.
I I have a Control (CTabCtrl) in a Dialog. In the derived class I handle a WM_CONTEXT message and display a contextmenu. How can I send the picked MenuEntry to my parent (Dialog) so that ít is possible to handle the choosen command.
When I handle the the Message IDC_MENU1 on my Dialog nothing happend. It only works when I handle the message in my Tab-Class....
|
|
|
|
|
Maybe...
Try handling all the messages in the tab class like this:
HWND dialog = GetParent(this);
PostMessage(dialog, themessage);
you can get themessage since it is specific to the handler in ur tabcontrol.
I wouldnt know though it's just a guess.
Kuniva
--------------------------------------------
|
|
|
|
|
Hi, i am writing a function to read in certain data from a file using stdio.h
but when i try to close the file handle with fclose() windows gives me the error "Myapp.exe has encountered a problem and needs to close. blablabla..."
This is the code:
FILE *npf;
char id[3];
float version;
if((npf = fopen(FileName, "rb")) == NULL)
{
fclose(npf);
return FALSE;
}
if(fseek(npf, 0L, SEEK_SET))
{
fclose(npf);
return FALSE;
}
fscanf(npf, "%s", id);
string IDs;
IDs.append(id);
MessageBox (NULL, IDs.c_str() , "ID", 0 + MB_ICONASTERISK);
fclose(npf);
return TRUE;
Also, you can see the lines i commented out where i try to read a float after reading the string, when i leave those in, i get the error at the line fscanf(npf, "%f", &version)
Can anyone tell me whats causing this? I looked at an example from the MSDN about file streams and i've worked with them before so i don't really see whats wrong here.
Thanks
P.S.: Yes, the file is big enough for the string and the float to be read.
Kuniva
--------------------------------------------
|
|
|
|
|
is the string longer than 2 characters? if so, you're overrunning the "id" buffer.
also, try opening the file in "r" mode, , not "rb".
-c
When history comes, it always takes you by surprise.
|
|
|
|
|
the string is 3 characters("npf"), but i thought it was like this:
id[0]="n"
id[1]="p"
id[2]="f"
and since it is id[3] there should be enough room.. right?
so dont u mean longer than 3 characters?
and i also thought the fscanf function reads in the data dependant of the size of the variable that is passed, so that it cant overrun the buffer...
or is this incorrect? i'm just guessing though, it's what i'd presume since there arent any other parameters passed to fscanf() which indicate what length it is.
But anyways, that cant be the problem anyways because i can display the id fine in a messagebox, the error only shows when i use fclose() or maybe after that... i'm not sure, because this is code for a function in a class i am writing. This is what i do(the class is called CNPFfile):
int main(int argc, char *argv[])
{
CNPFfile npf("npffile.npf");
BOOL bv = npf.IsValidNpfFile();
return 1;
}
I also tried opening the file in "r" mode, that didnt help.
Thank you kindly
Kuniva
--------------------------------------------
|
|
|
|
|
a string will have a 0 byte at the end. to read a 3 character string, you need a four byte buffer.
-c
When history comes, it always takes you by surprise.
|
|
|
|
|
OO WAIT lol
if i make it id[1000] then it works without errors... hmm so i guess fscanf doesnt get the number of bytes to read from the variable passed, oops. Hmm strange..
But anyways, what i'm actually trying to do here is to read in a serialised file, but not entirely, just some sort of header with a constant length. Like for example these are the first 8 bytes and the matching ASCII thingies:
6E 70 66 00 05 00 00 00
n p f
so i would think fscanf would stop at the 00 no?? Geesh this is complicated, maybe there is another function i should use for this? (i don't want to use MFC) I tried fread() already but didnt know how to start reading from a certain position with that cause i thought it always just started at the beginning, or can i use fseek() for that as well??
Kuniva
--------------------------------------------
|
|
|
|
|
I have been using C for nearly 20 years now. scanf is still a total mystery to me.
Since you are just passing the address of the string to fscanf, it has no idea how much space it can write over. This is one of many problems iostreams tried to fix with print/scanf.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
ok nevermind, it appears i can use fread for the job, thanks anyways
Kuniva
--------------------------------------------
|
|
|
|
|
Did you add null character end of id?
change your code to this:
<br />
char id[4]=NULL;<br />
fscanf(npf, "%s", id);<br />
id[3]='\0';<br />
A. Riazi
|
|
|
|
|
Hello All,
I have been having a problem I just don't know how to get by. I have a common dialog set up that I configure as I need at run-time. The default properties in the rc is CHILD and no FRAME (which is the majority of the times I need it) I have tried to change it to a pop-up window using ModifyStyle as well as SetWindowLong with out any luck. Anyone have any suggestions as to how this can be accomplished?
|
|
|
|
|
I'm not sure if someone in here can help. For a school project my son needs to write a code module in C to find the multiplicative inverse of ( X mod(26) ) using C-code if X and 26 HAVE common prime factors.
I'm a VB person and can't help him at all. Anybody out there that could give some advice?
Thanks
Claus
|
|
|
|
|
Is the problem with the math or the code? If you post a vb function that does it, then it will be simple to port it to C.
|
|
|
|
|
I guess I wasn't clear enough. I have no clue how to go about this and was hoping for a code example that would help me to understand how to do this.
Claus
|
|
|
|
|
If Y is a multiplicative inverse of X mod(26) then (X*Y) mod(26) = 1. But the only factors of 26 are the primes 2 and 13, so if X and 26 have common prime factors then X = 26*Z. Then (X*Y) mod(26) = (Z*Y*26) mod(26) = 0 for any Y, so X has no multiplicative inverse mod 26.
This looks like it might be helpful.
http://math.uh.edu/~minru/web/lincong2.html
|
|
|
|
|
This was exactly what I was hoping for. The site link is great too. Thanks, I'll relay that to my son.
Claus
|
|
|
|
|
Hello!
I want to eject and close cd rom drive. I implemented code through calls to DeviceIoControl function. But I cannot find out, how to detect that drive is ejected or closed
thanks in advance
|
|
|
|
|
I am a student preparing a final year project. My project involves a Microsoft C DLL (no class functions) to be called by VB program running under Win 98. I need to develop a progress bar in C DLL but not VB. The CProgressBar in www.codeproject.com is nice but I do not know how to incorporate it into my existing program.
In fact, I have tried to insert a new class name "CProgressBar" with base class "CProgressCtrl" as public but unsuccessful. The following reject message is displayed:
"The New Class Wizard could not find the appropriate header file to include for the base class CProgressCntrl. If you choose to derive from the class anyway, you may need to manually add the appropriate header file to C:\Mydata\ProgressBar.h."
I shall be most grateful if anyone can kindly advise how to solve this problem and how to show an AVI file at the same time.
Thank you for your kind attention.
wavewave
|
|
|
|
|
First question:
Just copy the "afxcmn.h" - File to your project dir.
Second:
You can use vfw32 (VideoForWindows) to play an Avi file. It's very simple...
|
|
|
|
|
Dear AnTri,
Thanks for your kind reply. I have copied the file into my project dir but still experience the same problem. I have inspected the afxcmn.h which does define the CProgressCtrl class. I wonder if the problem is due to my project is selected as Win32 DLL.
Is there any sample program to call vfw32 to play AVI file?
What is the calling statement from a VB program that passes an array of fixed length string to C which will return string values through the array?
Thanks for your kind help.
wavewave
|
|
|
|
|
Hello WaveWave,
you can define your fixed string in vb(a) like
dim fixString as string(80)
Progressbar:
I think CProgressCtrl is an MFC-Class. You can't use MFC-clases in Win32-DLL project!
Avi:
please post your e-mail adress so I can mail you an example of an gnu-avi player, which you can use in your dll.
|
|
|
|