C# :: Difference When Starting A Program From Network?
Aug 17, 2012
The following code prevents windows from letting the monitor go into sleep mode when the program is active and wakes the monitor up after a scanner scans something.
Code:
protected override void WndProc(ref Message m) {
if (m.Msg == W32.Const.WM_SYSCOMMAND &&
(m.WParam.ToInt32() & 0xfff0) == W32.Const.SC_MONITORPOWER && m.LParam.ToInt32() != -1)
{
return;
[Code] ....
When the program is started normally it works fine. But when the program is started from a network share it goes to sleep anyway and the OnScan does not work anymore. Removing the Send Message line makes On Scan work again but then the monitor wont wake up on a scan of course.
What could be the problem here when started from the network?
View 1 Replies
ADVERTISEMENT
Sep 21, 2014
I just started learning C and trying to create a program in C that will have a starting menu for a calculator. The problem is that I could do that with a switch/case but the assignment requires me to use if/else.
Here's what I have so far:
Code:
#include <stdio.h>
int calc();
int menu();
int main() {
printf("Hello. Welcome to the program.
");
printf("Press RETURN key to continue...
[Code]...
How should I go from now using if/else to have those 4 choices?
View 5 Replies
View Related
Nov 6, 2014
i writing a code which will calculate the difference between time_in and time out. Can i use a 2 dimensional array for example
int time_in[hours][minutes]
int time_out[hours[minutes]
View 3 Replies
View Related
Mar 9, 2013
My tasks was to write a program which finds difference between two arrays (elements which are in first array but not in second and vice-versa). Program works, but something wrong is with the memory allocation for array.
My code is:
main.c Code: #include <stdio.h>
#include <stdlib.h>
#include "header.h"
[Code]....
View 5 Replies
View Related
Jul 4, 2013
I'm challenged to write a program which calculates the time difference between two daytime.
compiler doesn't give an error, yet the warning: "format '%d' expects argument of type 'int *', but argument 3 has type 'int' [- Wformat]" for lines 24 and 26
However, by entering the first time the program crashes anyway. so I assume I do really need some pointer to make it read from the console can you see where my problem is?
Code:
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int Second;
int Minute;
int Hour;
}Time;
[Code]...
View 4 Replies
View Related
Oct 19, 2012
I need to make a program which solove difference between two interested times in format hh:mm i made it but it doesn't give me right answers for all times for example it can't solve times like 23:50 and 0:15 and it says that difference is 23:35 and no 00:25
View 3 Replies
View Related
Feb 3, 2014
I am just starting out learning C and I am using MinGW, Widnows 7, and cmd.exe.I am starting from scratch and learning very short and simple programs, like 20 lines long.After I use MinGW (gcc) to compile, the programs start up rather slowly, sometimes up to about 3-5 seconds. One with a big nested loop even took about 15 seconds to load. After they run once, the next time they run, it's instant.
Last time I learned from this book, I don't remember them starting so slowly. I use the command "gcc sample.c -o sample".It just concerns me that these tiny little programs are starting up so slowly. I'm scared it's a problem with my computer or MinGW installation. When I start making more advanced programs, I don't want them running slower than they ought to be.
View 12 Replies
View Related
Aug 10, 2014
Below is a snippet of my code in which it loops through a file trying to find the matching record of a selection given by the user. I use tellg() to tell me where the search begins and it does in fact start at the beginning. But when the search actually executes, it starts at the last record, loops once, and ends, as it does not find the matching record (when the user enters '24' for example)
void Hardware::updateExistingRecord(ofstream &addRecordInfo, ifstream &updateRecord, Hardware &_records) {
//selection on which field to update
enum Field { RECORD_NUMBER = 1, TOOL_NAME, QUANTITY, COST, EXIT };
cout << "Enter record number you would like to update
";
cout << "Enter zero to exit
?";
[Code] ....
View 10 Replies
View Related
Mar 6, 2015
I am trying to create a function to find the entry point of my map.But my program does not seem to be working correctly. I am trying to place a dot there because I will have to use recursion to fill up the whole map. But I'm not asking for the answer. I just need writing a function to locate the starting row for the first column of the maze (first non zero element). My code seems to have a bug in it when I try and call my function FindEntry. What I am trying to do is read in column by column until I can find the starting point and then place a dot there with ASCII character 249. This is my code so far:
Code:
#include<stdio.h>
#include<Windows.h>
#define HEIGHT 21
#define WIDTH 78
[Code]....
If you try and run it, it will give you a bug. But if you comment out the FindEntry function in the main it will work and look like this:
View 7 Replies
View Related
Feb 23, 2014
#include <stdio.h>
#include <stdlib.h>
int n;
int m;
char input[20];
int num;
int main() {
int num0;
[code]....
I'm supposed to write C program that will generate a 5 X 5 multiplication table starting with the number of the users choice. The program is supposed to operate within a loop and run until the user indicates that they no longer wish to enter any more numbers. I can get the program to run but am wondering what I need to do to get the program to ask for another number and how to make the program stop when the user no longer wants to play. Should I start with "Do you want to enter a number" if yes, run back through loop if no, goodbye?
View 8 Replies
View Related
Jan 22, 2013
The following code is useful to allow a user to select a particular folder in the disk directory.
Code:
void OpenFolder() {
LPMALLOC pMalloc; //,pMalloc2;
CString strDirectory;
BROWSEINFO bi;
// Gets the Shell's default allocator
wchar_t pszBuffer[MAX_PATH];
[Code] ....
However, if one uses this code over and over, one quickly becomes tired of threading one's way all the way from root directory C:. There is undoubtedly some way to designate a starting directory. The most obvious candidate to set such a target is the:
Code:
bi.pidlRoot = NULL;
But attempting to set bi.pidlRoot to a CString (directory address) errors because 'no suiitable conversion from CString to LPCITEMIDLIST exists'
How can I set the code to open at a designated address in the directory tree?
View 14 Replies
View Related
Nov 25, 2013
This problem relates to a program i am developing to ping all hosts on a network.
So far I've managed to access a PostgreSQL database to retrieve a CIDR network address e.g. 192.168.52.14/24.
I have then managed to mask the bits to get the network address.
So for e.g. above its 192.168.52.0
I now need some kind of algorithm to loop through available hosts so from.
192.168.52.0 - 192.168.52.255
I have got as far as deriving the network and separating it into an int array
So I have : ip_start[]= {192,168,52,0}
View 1 Replies
View Related
Jun 13, 2013
I'm wondering if there is a library for C++ that supports threading over the network, maybe with a threading pool and a specific protocol; or if there is just a de-facto protocol for doing threading over the network.
View 10 Replies
View Related
Feb 28, 2013
I want to change my system IP, subnet mask, host name etc. using win32 VC++.
I've tried AddIPAddress function but that's not persistent.
I want to change it that it should be change without rebooting system and should be there after restarting the system.
View 3 Replies
View Related
May 23, 2012
I have an application in c# that i don't want it to connect to the internet in a virtual environment, like virtualbox, vmware virtual pc and so on. Therefore i though that disabling the virtual network card inside the virtual machine would be a good idea.
View 3 Replies
View Related
Feb 3, 2015
create a artificial neural network for character recognition. URL.....Background:
- I have a good understanding of C++ and Assembly code and currently working on my java skills.(PF1, PF2, Paradigms, and microprocessing classes)
-I've programmed microprocessors(PIC) and will be using a PIC32MZ processor to operate the camera data collection and ANN operation. Currently, I plan to program this PIC in Assembly and C since I do not know if C++ will work on the microprocessor hardware.
View 2 Replies
View Related
Oct 1, 2014
How to use c++ to program network for a multiplayer online game or how would i go about this?
View 5 Replies
View Related
Jul 11, 2014
I know I can use ping internally to test a device's connectivity. What can I use to test devices on another network (assuming ports are forwarded, and their IP addresses are at my disposal)? I was looking into the TCP Client class.. would that also work with devices using DynDNS?
View 7 Replies
View Related
Feb 3, 2015
I want to build a proxy, middleman between various client programs on my machine and servers outside, like this:
Client -> Proxy -> Server, Client <- Proxy <- Server.
OSes are Windows XP, 7 and 8.
Within that proxy I want to analyze data before it reaches it's destination and have full control over it to the point where I can prevent a packet from reaching it's destination if my program finds something suspisious going on. I need incoming and outgoing traffic of specific adresses and ports to be forwarded into my application on my client machine. My app then should deliver packets to their destination after they were analyzed.
The parts where data is received, analyzed, manipulated if needed, and sent is something I could code with no difficulty. But the concept of redirecting and forwarding is hard for me to grasp at the moment. I'd like to know at least what winsock functions I have to use.
If it's possible, I would like to use Windows libraries only, nothing from 3rd parties.
View 3 Replies
View Related
Sep 16, 2014
Currently I'm trying to do something extremely basic: delete or move a file
I have a mapped network drive (Y) where I have a file I need to move from one folder to another
First was doing the obvious:
System.IO.File.Move("Y:TempFile.txt", "Y:Temp2File.txt");
Not much to go wrong here, right? As long as I have the correct permission to write in the folders and the folders exists, this would normally go smooth. But for some reason it only copies the file. The source file still exists, but it has successfully copied the file to the destination folder. No exceptions has been thrown or anything... but the file still exists in the source directory
I then changed the code to the following:
System.IO.File.Copy("Y:TempFile.txt", "Y:Temp2File.txt");
System.IO.File.Delete("Y:TempFile.txt");
Console.WriteLine("See mommy, no Exceptions");
As expected the file copies correctly, but the delete command is completely ignored. The file is not deleted, but the Console.WriteLine command is called
I'm running the application as the logged in user. The user has permission to delete the file. If I try from Windows Explorer, the file is correctly deleted. Unfortunately my application refuses to delete the file and even worse, it will not even throw an Exception.
View 10 Replies
View Related
Aug 9, 2013
I wrote an application with wpf and c sharp. And I use ado dotnet framework to connect the database. Now the problem is I want a centralize database for the application. And I hav e installed sql server on one of the which I want to serve as server. I now want all other clients to be able to connect to the database through local area network. how will I do that?
View 2 Replies
View Related
Sep 10, 2014
I basically want to develop an application which print an existing file on reception of a network event (application will be running on a seven 64 bits PC).
I wonder which application type would be the most suitable (and the simplest) for that (console win32, win32 app, MFC app ...). As this application does not need user intervention (print on network event), I'm not sure that I need a MFC application or a win32 app.
View 9 Replies
View Related
May 3, 2014
Assume you want to use a loop to process an array of characters starting from the beginning of the array. You want the loop to stop when you read the null terminator character from the array. Fill in the loop test condition that will make this work correctly.
index = 0;
ch = array[index];
while ( _____________________________)
{
// process the character
index++;
ch = array[index];
}
View 1 Replies
View Related
Sep 8, 2014
I need to find a string with leading spaces like " target sting" inside another sting.
And I need to find something like "target sting" inside another sting.
I used .IndexOf() but noticed it ignores leading spaces.
So then I went with .Substring() but that doesn't seem like that's the best solution either.
View 5 Replies
View Related
Feb 8, 2015
I am trying to make kind of a messenger using Socket/Network Programming
My program should allow clients to register or sign in, after they are signed in they should see a list of the other signed in people whoever I select from that list I should be able to implement using multiple threads as well.
I have done this much:
User.txt file
ahsan,1234
bilal,1234
pappu,1234
babu,1234
Client.c
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
[code]....
Now issue is in this code I am getting error SEGEMENTATION ERROR, CORE DUMP
View 5 Replies
View Related
Sep 22, 2014
I'm trying to figure out how I can create a vertex array object at offset of a vertex buffer object.I've created the buffer object. I'd like the "texs" idnex data to start at the texture coordinate content of the vertex_t structure.
Type definitions:
struct vertex_t {
vector3d_t position;
float s; // Texture coordinate s
float t; // Texture coordinate t
};
Code so far:
// How do I make this start at a certain spot of the VBO?!
glVertexAttribPointer(texs, 2, GL_FLOAT, GL_FALSE, sizeof(vector3d_t), nullptr;
//...
View 1 Replies
View Related